Source code: users.pal
From PROSE Programming Language - Wiki
% % Read users from stdin (/etc/passwd file) and populate one container % in the nexus for each username listed % ._init func/def [main], &[.main] local/rtn .main % % Preparation % reg/load P10, ![.prose.sys.io] attr/load P11, [psStreamIn], P13, [description] class/load P12, [psContainer] % % Create top-level container for the users % obj/def P8 class/add P8, P12 obj/commit ![.prose], [users], P8 reg/load P9, ![.prose.users] .loop % % Load next line from stdin % attr/copy P0, P10, P11 reg/jmpeq &[.eof], P0, NULL % % Extract username (field 1, up to first colon) % reg/xscan P1, P0, [:] reg/copy P2, (P0, #0, P1) % % Extract GECOS description (field 5) % reg/load A, #3 .loop2 op/incr P1 reg/xscan P1, P0, [:], P1 op/decr reg/jmpneq &[.loop2], A, #0 op/incr P1 reg/xscan P4, P0, [:], P1 opx/sub P4, P4, P1 reg/copy P3, (P0, P1, P4) reg/clr P0 % % Create a container for this user % obj/def P8 class/add P8, P12 attr/add P8, P13, P3 obj/commit P9, P2, P8 reg/clr P2 local/jmp &[.loop] .eof % % Read the user objects and display to stdout % attr/load P11, [psStreamOut], P12, [pn] reg/load P0, (P9) .loop3 reg/load P1, (P0) reg/jmpeq &[.exit], P1, NULL attr/copy P2, P1, P12 attr/copy P3, P1, P13 reg/copy P4, [User '], P2, [' (], P3, [)\n] attr/mod P10, P11, P4 reg/clr P2, P3 local/jmp &[.loop3] .exit func/rtn