關於 .o 檔的資料變更 - 聖殿英雄傳說 MUD
By Noah
at 2019-01-31T15:13
at 2019-01-31T15:13
Table of Contents
打報告打到快睡著,這篇大致提一下做法。
首先去 read .o 檔,然後 explode
strs=read_file(files+".o");
tmps=explode(strs,"\n");
接著土法煉鋼,讀出每個變數
foreach(tmp in tmps)
{
i=0;
while(tmp[i..i]!=" ")
i++;
vars=([tmp[0..i],
}
然後去產生一個臨時的 .c 檔:
[email protected]
inherit DAEMON;
LONG
;
content+="mixed ";
foreach(tmp in tmps)
content+=tmp+",";
content+="\n\n";
[email protected]
void create()
{
::create();
seteuid(getuid(this_object()));
LONG;
content+=" restore_object("+file+");\n}\n\n";
write_file("/open/tmp_load.c",content);
update_files("/open/tmp_load");
這樣 /open/tmp_load.c 就能用來 restore 目標 .o 檔,並且
將載入的變數資料也全部存在這個 tmp_load.c 物件裡頭。
當然實際上跟 running 一樣,這東西寫起來是落落長的,不過
如果能寫出來,好處很多。
LAechan
--
首先去 read .o 檔,然後 explode
strs=read_file(files+".o");
tmps=explode(strs,"\n");
接著土法煉鋼,讀出每個變數
foreach(tmp in tmps)
{
i=0;
while(tmp[i..i]!=" ")
i++;
vars=([tmp[0..i],
}
然後去產生一個臨時的 .c 檔:
[email protected]
inherit DAEMON;
LONG
;
content+="mixed ";
foreach(tmp in tmps)
content+=tmp+",";
content+="\n\n";
[email protected]
void create()
{
::create();
seteuid(getuid(this_object()));
LONG;
content+=" restore_object("+file+");\n}\n\n";
write_file("/open/tmp_load.c",content);
update_files("/open/tmp_load");
這樣 /open/tmp_load.c 就能用來 restore 目標 .o 檔,並且
將載入的變數資料也全部存在這個 tmp_load.c 物件裡頭。
當然實際上跟 running 一樣,這東西寫起來是落落長的,不過
如果能寫出來,好處很多。
LAechan
--
Tags:
線上
All Comments
By Vanessa
at 2019-02-05T11:46
at 2019-02-05T11:46
By Hedda
at 2019-02-10T08:20
at 2019-02-10T08:20
By Vanessa
at 2019-02-15T04:53
at 2019-02-15T04:53
By Dinah
at 2019-02-20T01:26
at 2019-02-20T01:26
By Suhail Hany
at 2019-02-24T22:00
at 2019-02-24T22:00
By Agatha
at 2019-03-01T18:33
at 2019-03-01T18:33
By Ophelia
at 2019-03-06T15:06
at 2019-03-06T15:06
Related Posts
回饋紫卡 08 Manny
By Eartha
at 2019-01-31T13:52
at 2019-01-31T13:52
OC Trials 太平洋區資訊
By Hedy
at 2019-01-31T10:41
at 2019-01-31T10:41
炎獅這一刀是不是砍得太重了
By Daph Bay
at 2019-01-31T10:04
at 2019-01-31T10:04
Moowe
By Joe
at 2019-01-31T09:47
at 2019-01-31T09:47
PTR 1/30 新地圖 - 巴黎
By Irma
at 2019-01-31T07:30
at 2019-01-31T07:30