Cookie帮助我们提供我们的服务。通过使用我们的服务,您同意我们使用cookie。
更多信息
查看“宏”的源代码
←
宏
跳转至:
导航
,
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于这些用户组的用户使用:
用户
,emailconfirmed,arcowiki,consultant
您可以查看与复制此页面的源代码。
'''Macro''' are sub-routines that allow to compact a sequence of instructions in a single command.<br/> The macro command can be in the main program or in an external file.<br/> == == If the macro description is inside the [[DMIS]] program, it should be written at the beginning of it but, in any case, prior to the execution of the Macro command itself.<br/> <code><span style="color: green; text-decoration: none;">$$ Example of a MACRO declaration</span><br/></code> ::<code>M(foro)=MACRO/off_x,off_y,'nome_ci'</code> ::::<code> DECL/LOCAL,DOUBLE,r_foro,z_mis</code> ::::<code> r_foro=ASSIGN/6.25</code> ::::<code> z_mis=ASSIGN/-2.5</code> ::::<code> F(@nome_ci) = FEAT/CIRCLE, INNER, CART, off_x, off_y, z_mis, 0, 0, 1, r_foro*2</code> ::::<code> MEAS/CIRCLE, F(@nome_ci), 4</code> ::::<code> GOTO/off_x, off_y, 7</code> ::::<code> PTMEAS/CART, off_x+r_foro, off_y, z_mis, -1, 0, 0</code> ::::<code> PTMEAS/CART, off_x, off_y+r_foro, z_mis, 0, -1, 0</code> ::::<code> PTMEAS/CART, off_x-r_foro, off_y, z_mis, 1, 0, 0</code> ::::<code> PTMEAS/CART, off_x, off_y-r_foro, z_mis, 0, 1, 0</code> ::::<code> GOTO/off_x, off_y, 7</code> ::::<code> ENDMES</code> ::::<code><span style="color: green; text-decoration: none;">$$ End of Macro Declaration</span><br/></code> ::<code>ENDMAC</code> ::<code><span style="color: green; text-decoration: none;">$$ instructions</span><br/></code> ::<code><span style="color: green; text-decoration: none;">$$ instructions</span><br/></code> <code><span style="color: green; text-decoration: none;">$$ Recall to execute the macro</span><br/></code> ::<code>CALL/M(foro),12.5,12.5,foro1</code> ::<code><span style="color: green; text-decoration: none;">$$ instructions</span><br/></code> ::<code><span style="color: green; text-decoration: none;">$$ instructions</span><br/></code> == == If the macro is located in an external file (for example to make sure that the macro can be shared between more programs), then the macro file shall be inserted in the program using the procedure to [[Include an External Macro File]] at the beginning of the program using an ‘EXTFIL’ command. In this case the macros are recalled from the specified external file. <code><span style="color: green; text-decoration: none;">$$ Use of an external file containing macro declaration</span><br/></code> ::<code>EXTFIL/DMIS,'c:\cim\MACRO.dmi'<br/></code> The [[External Macro File|external macro file]] has “.DML” extension, begins with <code>DMISMD/</code> and ends with <code>ENDFIL/</code>.<br/> Inside of the file, the syntax is the same as a regular [[DMIS]] program. <code><span style="color: green; text-decoration: none;">$$ Declaration of different Macro in an external file</span><br/></code> <code>DMISMD/'module_name'</code><br/> ::<code><span style="color: green; text-decoration: none;">$$ First Macro declaration</span><br/></code> ::<code>M(macro_1)=MACRO/passedtext</code> ::::<code>TEXT/OPER,CONCAT('You passed the following text to the macro: ',passedtext)</code> ::<code>ENDMAC</code><br/> ::<code><span style="color: green; text-decoration: none;">$$ Second Macro declaration</span><br/></code> ::<code>M(macro_2)=MACRO/num1,num2</code> ::::<code>DECL/DOUBLE,sumres</code> ::::<code>sumres=ASSIGN/num1+num2</code> ::::<code>EXT/OPER,CONCAT('The sum of the 2 numbers is: ',STR(sumres))</code> ::<code>ENDMAC</code> <code>ENDFIL</code> [[it:Macro]] [[zh-cn:宏]] [[pt:Macro]] [[de:Makro]] [[es:Macro]] [[en:Macro]]
返回至
宏
。
导航菜单
个人工具
登录
命名空间
页面
讨论
不转换
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
台灣正體
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
帮助
工具
链入页面
相关更改
特殊页面
页面信息