I'm doing macro programming, and I would like to know what is the cross-referencing source code in
plain.tex, so that I can apply those source codes to my own .sty file. If anybody can give me some hints about it that will be highly appreciated.
plain tex has almost no automatic numbering the section headings and list commands use explicit numbers so there is little need for mechanised cross refs, to refer to section 2 just type "section 2"
Of course macro packages built on plain may define a cross reference mechanism. Barbara mentions manmac, as used for the TeXBook sources, also eplain defines a cross reference mechanism similar to LaTeX's
\ref system, see section 4.9 of the eplain manual.