postscript - 如何将堆栈的全部内容复制到 PostScript 中的数组中
问题描述
简单明了:如何将堆栈的内容复制到 PostScript 中的数组中?
解决方案
首先你需要做一个足够大的数组来容纳所有的元素,所以你需要用它count
来找出有多少元素。然后您需要创建一个该大小的数组,最后您需要将所有元素放入数组中。
如果你想让堆栈不受干扰,这对我来说并不是很明显,所以这里有两种方法:
%!
count % Count elements on stack - stack contains <elements...> n
array % Create array of that size - stack contains <elements...> []
astore % Move all elements from stack to array - stack contains [<elements...>]
现在,如果您想让堆栈不受干扰:
%!
count % Count elements on stack - stack contains <elements...> n
array % Create array of that size - stack contains <elements...> []
astore % Move all elements from stack to array - stack contains [<elements...>]
aload % Push elements from array to stack - stack contains <elements...> [<elements...>]
推荐阅读
- python - 计算递归调用函数的次数(Python)
- c++ - 有谁能解释一下这个 boost create_thread 行吗?
- spring-boot - 将 RestTemplate 响应转换为新格式(SpringBoot):正确的方法是什么?
- windows - 将字符串插入多个文件名
- jquery - JQuery将按钮一次添加到列表项
- reactjs - 使用 React 从数据创建表
- python - 会话没有在烧瓶中保持价值?
- python - 熊猫列的 collections.Counter 对象
- python - Python asyncio线程监听按键'r'或'u',同时允许主程序运行
- nginx - NGinx 是否支持 Websocket 连接的健康检查?