{"id":1711,"date":"2015-01-09T23:13:46","date_gmt":"2015-01-09T15:13:46","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=1711"},"modified":"2015-01-09T23:13:46","modified_gmt":"2015-01-09T15:13:46","slug":"qmacros-%e6%9b%b4%e6%96%b0-%e6%96%b0%e5%a2%9e%e7%bc%96%e8%af%91%e9%80%89%e9%a1%b9%e5%92%8c%e6%9e%9a%e4%b8%be%e6%a8%a1%e6%9d%bf%e4%bd%bf%e7%94%a8%e7%9a%84%e5%ae%8f%e5%90%8d%e7%a7%b0%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=1711","title":{"rendered":"QMacros \u66f4\u65b0 &#8211; \u65b0\u589e\u7f16\u8bd1\u9009\u9879\u548c\u679a\u4e3e\u6a21\u677f\u4f7f\u7528\u7684\u5b8f\u540d\u79f0\u51fd\u6570"},"content":{"rendered":"<p>\u3010\u66f4\u65b0\u5185\u5bb9\u3011<\/p>\n<p>1\u3001\u00a0\u7f16\u8bd1\u65f6\u7684\u6807\u5fd7\u4f4d\u65b0\u589e\u00a0MRF_DELAY_BINDING \uff0c\u5f53\u8be5\u6807\u5fd7\u4f4d\u8bbe\u8ba1\uff0c\u5982\u679c\u7f16\u8bd1\u65f6\u5bf9\u5e94\u7684\u540d\u79f0\u7684\u5b8f\u672a\u627e\u5230\uff0c\u4e0d\u4f1a\u629b\u51fa\u5f02\u5e38\u3002\u7528\u6237\u53ea\u9700\u8981\u5728\u7b2c\u4e00\u6b21\u8c03\u7528Replace\u524d\u4e3a\u76f8\u5e94\u7684\u5b8f\u8d4b\u503c\u5165\u6808\u5f53\u524d\u503c\u5373\u53ef\u3002<\/p>\n<p>2\u3001TQMacroComplied \u65b0\u589e\u51fd\u6570 EnumUsedMacros \u51fd\u6570\u6765\u679a\u4e3e\u6a21\u677f\u4e2d\u4f7f\u7528\u7684\u7c7b\u578b\u4e0d\u662f mvImmutable \u5b8f\u7684\u540d\u79f0\u3002mvImmutable \u7c7b\u578b\u7684\u5b8f\u5728\u7f16\u8bd1\u65f6\u5c31\u5df2\u7ecf\u8f6c\u6362\u4e3a\u666e\u901a\u7684\u5b57\u7b26\u4e32\u4e86\uff0c\u4e0d\u9700\u8981\u518d\u6b21\u89e3\u6790\u3002<\/p>\n<p>\u3010\u793a\u4f8b\u3011<\/p>\n<pre class=\"lang:delphi decode:true \">var\r\n  AComplied: TQMacroComplied;\r\n  AList:TStringList;\r\n  I,sp: Integer;\r\nbegin\r\nAComplied := FMacroMgr.Complie('%\u59d3\u540d%:%\u5e74\u9f84%', '%', '%',MRF_DELAY_BINDING);\r\nif AComplied&lt;&gt;nil then\r\n  begin\r\n  AList:=TStringList.Create;\r\n  Memo2.Lines.Add('\u5f53\u524d\u5185\u5bb9\u4e2d\u5305\u62ec'+IntToStr(AComplied.EnumUsedMacros(AList))+'\u4e2a\u5b8f\u5b9a\u4e49:');\r\n  Memo2.Lines.AddStrings(AList);\r\n  sp:=FMacroMgr.SavePoint;\r\n  for I := 0 to AList.Count-1 do\r\n    begin\r\n    FMacroMgr.Push(AList[I],'\u5ef6\u8fdf\u7ed1\u5b9a\u503c'+IntToStr(I));\r\n    end;\r\n  Memo2.Lines.Add(AComplied.Replace);\r\n  FMacroMgr.Restore(sp);\r\n  FreeObject(AList);\r\n  FreeObject(AComplied);\r\n  end;\r\nend;<\/pre>\n<p>\u3010\u66f4\u65b0\u7ea7\u522b\u3011<\/p>\n<p>\u53ef\u9009<\/p>\n<p>\u3010\u7279\u522b\u611f\u8c22\u3011<\/p>\n<p>\u963f\u6728<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u66f4\u65b0\u5185\u5bb9\u3011 1\u3001\u00a0\u7f16\u8bd1\u65f6\u7684\u6807\u5fd7\u4f4d\u65b0\u589e\u00a0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[69,8,9,214,2],"tags":[],"class_list":["post-1711","post","type-post","status-publish","format-standard","hentry","category-c-builder","category-delphi","category-qdac","category-qmacros","category-update"],"views":2635,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1711"}],"version-history":[{"count":1,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1711\/revisions"}],"predecessor-version":[{"id":1712,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1711\/revisions\/1712"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}