關於 .o 檔的資料變更 - 聖殿英雄傳說 MUD

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

--

All Comments

Vanessa avatarVanessa2019-02-05
其實用 javascript 也可以寫 .o 檔的讀取工具,年後
Hedda avatarHedda2019-02-10
我找時間寫
Vanessa avatarVanessa2019-02-15
沒有值的屬性不會出現在 .o 檔
Dinah avatarDinah2019-02-20
直接decode為mapping, 編輯後再encode會比較通用
Suhail Hany avatarSuhail Hany2019-02-24
Agatha avatarAgatha2019-03-01
可以修改來處理 .o 格式
Ophelia avatarOphelia2019-03-06
呃沒要增刪改,讀取而已,堪用即可