From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Engeler Newsgroups: gmane.emacs.devel Subject: Contribution: Serial port access Date: Mon, 21 Apr 2008 22:36:38 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v919.2) Content-Type: multipart/mixed; boundary=Apple-Mail-7-722248515 X-Trace: ger.gmane.org 1208834550 4464 80.91.229.12 (22 Apr 2008 03:22:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Apr 2008 03:22:30 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 22 05:23:05 2008 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Jo91Z-0004bU-Ml for ged-emacs-devel@m.gmane.org; Tue, 22 Apr 2008 05:23:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jo90o-0002Eb-VB for ged-emacs-devel@m.gmane.org; Mon, 21 Apr 2008 23:17:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jo2lp-0005Pi-M5 for emacs-devel@gnu.org; Mon, 21 Apr 2008 16:37:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jo2lc-0005Oe-Sa for emacs-devel@gnu.org; Mon, 21 Apr 2008 16:37:49 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jo2lc-0005Ob-Lj for emacs-devel@gnu.org; Mon, 21 Apr 2008 16:37:36 -0400 Original-Received: from fk-out-0910.google.com ([209.85.128.186]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jo2lR-0005bl-Cn for emacs-devel@gnu.org; Mon, 21 Apr 2008 16:37:36 -0400 Original-Received: by fk-out-0910.google.com with SMTP id 26so2660090fkx.10 for ; Mon, 21 Apr 2008 13:36:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to:content-type:mime-version:subject:date:x-mailer; bh=i7Zr29407avFSRFqC7R2WViPsyU6s3iIfTT1aOHjJUo=; b=mzWDSgFfxreUlL8nB1eyExa/DnIKy9KoYT0/8h/MDOkg+yUySppq2K8CEi/nHJb0ryJe+GJ4q07Qjbn78+lkeryqa/k3/aMRAYRB73rLw3nzlmkIky9WNFKCJICr+vRrv796C4lSf+0Dct0NanQbovr9T5Ldv8QN+MbTQff5iJw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:content-type:mime-version:subject:date:x-mailer; b=HQBBiHhk2qcz26CeHWsTcK25zpLyxDXMlFFy0QKDGii5d5BIHlLKVGR6APMQdT+7Kqvka8fbNERzoU12bfTiH9RVdN36LmB0WhmQZyDVHhIII/hSGQqzPgGFnKCcX0R17Sg5eZ6T4319HW7n7BiFmfqtpUpYnHmVJZzm4co98Iw= Original-Received: by 10.82.166.9 with SMTP id o9mr11655797bue.32.1208810205253; Mon, 21 Apr 2008 13:36:45 -0700 (PDT) Original-Received: from ?192.168.1.6? ( [212.254.35.77]) by mx.google.com with ESMTPS id i5sm16161287mue.7.2008.04.21.13.36.40 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 21 Apr 2008 13:36:43 -0700 (PDT) X-Mailer: Apple Mail (2.919.2) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-Mailman-Approved-At: Mon, 21 Apr 2008 23:16:53 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:95730 Archived-At: --Apple-Mail-7-722248515 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Hi, this is my first contribution to Emacs: Serial port access for GNU/ Linux, Unix, and Windows. The changes provide mainly `serial- term' (similar to `term') and `make-serial-process' (similar to `make- network-process'). This lets Emacs read from and write to serial ports. Serial port parameters such as speed and bytesize can be configured interactively. All changes are fully documented, in every function and in the documentation. I tested the code on Mac OS X 10.5.2 and Windows XP SP2. I additionally compiled it on GNU/Linux (Fedora Core 5). I hope it works fine! Regards, Daniel Engeler --Apple-Mail-7-722248515 Content-Disposition: attachment; filename=engeler-serial.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="engeler-serial.diff" Content-Transfer-Encoding: quoted-printable Index:=20doc/emacs/emacs.texi=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/doc/emacs/emacs.texi,v=0Aretrieving=20revision=20= 1.8=0Adiff=20-c=20-p=20-r1.8=20emacs.texi=0A***=20doc/emacs/emacs.texi=09= 28=20Mar=202008=2019:03:21=20-0000=091.8=0A---=20doc/emacs/emacs.texi=09= 21=20Apr=202008=2019:55:39=20-0000=0A***************=20Running=20Shell=20= Commands=20from=20Emacs=0A***=20864,869=20****=0A---=20864,870=20----=0A=20= =20*=20Term=20Mode::=20=20=20=20=20=20=20=20=20=20=20Special=20Emacs=20= commands=20used=20in=20Term=20mode.=0A=20=20*=20Paging=20in=20Term::=20=20= =20=20=20=20Paging=20in=20the=20terminal=20emulator.=0A=20=20*=20Remote=20= Host::=09=09Connecting=20to=20another=20computer.=0A+=20*=20Serial=20= Terminal::=20=20=20=20=20Connecting=20to=20a=20serial=20port.=0A=20=20=0A= =20=20Using=20Emacs=20as=20a=20Server=0A=20=20=0AIndex:=20= doc/emacs/misc.texi=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/doc/emacs/misc.texi,v=0Aretrieving=20revision=201.5=0A= diff=20-c=20-p=20-r1.5=20misc.texi=0A***=20doc/emacs/misc.texi=0922=20= Jan=202008=2023:53:32=20-0000=091.5=0A---=20doc/emacs/misc.texi=0921=20= Apr=202008=2019:55:41=20-0000=0A***************=20Eshell:=20The=20Emacs=20= Shell}.=0A***=20350,355=20****=0A---=20350,356=20----=0A=20=20*=20Term=20= Mode::=20=20=20=20=20=20=20=20=20=20=20=20=20=20Special=20Emacs=20= commands=20used=20in=20Term=20mode.=0A=20=20*=20Paging=20in=20Term::=20=20= =20=20=20=20=20=20=20Paging=20in=20the=20terminal=20emulator.=0A=20=20*=20= Remote=20Host::=20=20=20=20=20=20=20=20=20=20=20=20Connecting=20to=20= another=20computer.=0A+=20*=20Serial=20Terminal::=20=20=20=20=20=20=20=20= Connecting=20to=20a=20serial=20port.=0A=20=20@end=20menu=0A=20=20=0A=20=20= @node=20Single=20Shell=0A***************=20handles=20each=20one=20= appropriately,=20changing=0A***=201076,1082=20****=0A=20=20appearance=20= of=20the=20window=20matches=20what=20it=20would=20be=20on=20a=20real=20= terminal.=0A=20=20You=20can=20actually=20run=20Emacs=20inside=20an=20= Emacs=20Term=20window.=0A=20=20=0A!=20=20=20=20The=20file=20name=20used=20= to=20load=20the=20subshell=20is=20determined=20the=20same=20way=0A=20=20= as=20for=20Shell=20mode.=20=20To=20make=20multiple=20terminal=20= emulators,=20rename=20the=0A=20=20buffer=20@samp{*terminal*}=20to=20= something=20different=20using=20@kbd{M-x=0A=20=20rename-uniquely},=20= just=20as=20with=20Shell=20mode.=0A---=201077,1086=20----=0A=20=20= appearance=20of=20the=20window=20matches=20what=20it=20would=20be=20on=20= a=20real=20terminal.=0A=20=20You=20can=20actually=20run=20Emacs=20inside=20= an=20Emacs=20Term=20window.=0A=20=20=0A!=20=20=20You=20can=20use=20Term=20= mode=20to=20communicate=20with=20a=20device=20connected=20to=20a=0A!=20= serial=20port=20of=20your=20computer,=20see=20@ref{Serial=20Terminal}.=0A= !=20=0A!=20=20=20The=20file=20name=20used=20to=20load=20the=20subshell=20= is=20determined=20the=20same=20way=0A=20=20as=20for=20Shell=20mode.=20=20= To=20make=20multiple=20terminal=20emulators,=20rename=20the=0A=20=20= buffer=20@samp{*terminal*}=20to=20something=20different=20using=20= @kbd{M-x=0A=20=20rename-uniquely},=20just=20as=20with=20Shell=20mode.=0A= ***************=20off=20directory=20tracking.=0A***=201232,1237=20****=0A= ---=201236,1268=20----=0A=20=20=0A=20=20@end=20ignore=0A=20=20=0A+=20= @node=20Serial=20Terminal=0A+=20@subsection=20Serial=20Terminal=0A+=20= @cindex=20serial=20terminal=0A+=20@findex=20serial-term=0A+=20=0A+=20=20=20= If=20you=20have=20a=20device=20connected=20to=20a=20serial=20port=20of=20= your=20computer,=0A+=20you=20can=20use=20Emacs=20to=20communicate=20with=20= it.=20=20@kbd{M-x=20serial-term}=20will=0A+=20ask=20you=20for=20a=20= serial=20port=20name=20and=20speed=20and=20will=20then=20open=20a=20new=0A= +=20window=20in=20@ref{Term=20Mode}.=0A+=20=0A+=20=20=20The=20speed=20of=20= the=20serial=20port=20is=20measured=20in=20bits=20per=20second.=20=20The=0A= +=20most=20common=20speed=20is=209600=20bits=20per=20second.=20=20You=20= can=20change=20the=20speed=0A+=20interactively=20by=20clicking=20on=20= the=20mode=20line.=0A+=20=0A+=20=20=20A=20serial=20port=20can=20be=20= configured=20even=20more=20by=20clicking=20on=20``8N1''=20in=0A+=20the=20= mode=20line.=20=20By=20default,=20a=20serial=20port=20is=20configured=20= as=20``8N1'',=0A+=20which=20means=20that=20each=20byte=20consists=20of=20= 8=20data=20bits,=20No=20parity=20check=0A+=20bit,=20and=201=20stop=20= bit.=0A+=20=0A+=20=20=20When=20you=20have=20opened=20the=20serial=20port=20= connection,=20you=20will=20see=20output=0A+=20from=20the=20device=20in=20= the=20window.=20=20Also,=20what=20you=20type=20in=20the=20window=20is=0A= +=20sent=20to=20the=20device.=0A+=20=0A+=20=20=20If=20the=20speed=20or=20= the=20configuration=20is=20wrong,=20you=20cannot=20communicate=0A+=20= with=20your=20device=20and=20will=20probably=20only=20see=20garbage=20= output=20in=20the=0A+=20window.=0A+=20=0A=20=20@node=20Emacs=20Server,=20= Printing,=20Shell,=20Top=0A=20=20@section=20Using=20Emacs=20as=20a=20= Server=0A=20=20@pindex=20emacsclient=0AIndex:=20doc/lispref/elisp.texi=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/doc/lispref/elisp.texi,v=0Aretrieving=20revision=20= 1.6=0Adiff=20-c=20-p=20-r1.6=20elisp.texi=0A***=20doc/lispref/elisp.texi=09= 13=20Mar=202008=2003:15:39=20-0000=091.6=0A---=20doc/lispref/elisp.texi=09= 21=20Apr=202008=2019:55:44=20-0000=0A***************=20Processes=0A***=20= 1195,1200=20****=0A---=201195,1201=20----=0A=20=20*=20Low-Level=20= Network::=20=20=20=20=20=20=20Lower-level=20but=20more=20general=20= function=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20to=20create=20connections=20and=20= servers.=0A=20=20*=20Misc=20Network::=20=20=20=20=20=20=20=20=20=20=20=20= Additional=20relevant=20functions=20for=20network=20connections.=0A+=20*=20= Serial=20Ports::=20=20=20=20=20=20=20=20=20=20=20=20Communicating=20with=20= serial=20ports.=0A=20=20*=20Byte=20Packing::=20=20=20=20=20=20=20=20=20=20= =20=20Using=20bindat=20to=20pack=20and=20unpack=20binary=20data.=0A=20=20= =0A=20=20Receiving=20Output=20from=20Processes=0AIndex:=20= doc/lispref/internals.texi=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/doc/lispref/internals.texi,v=0Aretrieving=20= revision=201.3=0Adiff=20-c=20-p=20-r1.3=20internals.texi=0A***=20= doc/lispref/internals.texi=098=20Jan=202008=2020:45:46=20-0000=091.3=0A= ---=20doc/lispref/internals.texi=0921=20Apr=202008=2019:55:45=20-0000=0A= ***************=20A=20string,=20the=20name=20of=20the=20process.=0A***=20= 1433,1439=20****=0A=20=20=0A=20=20@item=20command=0A=20=20A=20list=20= containing=20the=20command=20arguments=20that=20were=20used=20to=20start=20= this=0A!=20process.=0A=20=20=0A=20=20@item=20filter=0A=20=20A=20function=20= used=20to=20accept=20output=20from=20the=20process=20instead=20of=20a=20= buffer,=0A---=201433,1440=20----=0A=20=20=0A=20=20@item=20command=0A=20=20= A=20list=20containing=20the=20command=20arguments=20that=20were=20used=20= to=20start=20this=0A!=20process.=20For=20a=20network=20or=20serial=20= process,=20it=20is=20@code{nil}=20if=20the=0A!=20process=20is=20running=20= or=20@code{t}=20if=20the=20process=20is=20stopped.=0A=20=20=0A=20=20= @item=20filter=0A=20=20A=20function=20used=20to=20accept=20output=20from=20= the=20process=20instead=20of=20a=20buffer,=0A***************=20The=20= associated=20buffer=20of=20the=20process.=0A***=201449,1456=20****=0A=20=20= An=20integer,=20the=20operating=20system's=20process=20@acronym{ID}.=0A=20= =20=0A=20=20@item=20childp=0A=20=20A=20flag,=20non-@code{nil}=20if=20= this=20is=20really=20a=20child=20process.=0A!=20It=20is=20@code{nil}=20= for=20a=20network=20connection.=0A=20=20=0A=20=20@item=20mark=0A=20=20A=20= marker=20indicating=20the=20position=20of=20the=20end=20of=20the=20last=20= output=20from=20this=0A---=201450,1458=20----=0A=20=20An=20integer,=20= the=20operating=20system's=20process=20@acronym{ID}.=0A=20=20=0A=20=20= @item=20childp=0A+=20=0A=20=20A=20flag,=20non-@code{nil}=20if=20this=20= is=20really=20a=20child=20process.=0A!=20It=20is=20@code{nil}=20for=20a=20= network=20or=20serial=20connection.=0A=20=20=0A=20=20@item=20mark=0A=20=20= A=20marker=20indicating=20the=20position=20of=20the=20end=20of=20the=20= last=20output=20from=20this=0A***************=20Size=20of=20carryover=20= in=20encoding.=0A***=201515,1520=20****=0A---=201517,1526=20----=0A=20=20= @item=20inherit_coding_system_flag=0A=20=20Flag=20to=20set=20= @code{coding-system}=20of=20the=20process=20buffer=20from=20the=0A=20=20= coding=20system=20used=20to=20decode=20process=20output.=0A+=20=0A+=20= @item=20type=0A+=20Symbol=20indicating=20the=20type=20of=20process:=20= real,=20network,=20serial=0A+=20=0A=20=20@end=20table=0A=20=20=0A=20=20= @ignore=0AIndex:=20doc/lispref/processes.texi=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/doc/lispref/processes.texi,v=0Aretrieving=20= revision=201.5=0Adiff=20-c=20-p=20-r1.5=20processes.texi=0A***=20= doc/lispref/processes.texi=0925=20Mar=202008=2017:50:06=20-0000=091.5=0A= ---=20doc/lispref/processes.texi=0921=20Apr=202008=2019:55:49=20-0000=0A= ***************=20This=20function=20returns=20@code{t}=20if=20@var{o=0A= ***=2053,58=20****=0A---=2053,59=20----=0A=20=20*=20Low-Level=20= Network::=20=20=20=20=20=20=20=20Lower-level=20but=20more=20general=20= function=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20to=20create=20connections=20and=20= servers.=0A=20=20*=20Misc=20Network::=20=20=20=20=20=20=20=20=20=20=20=20= =20Additional=20relevant=20functions=20for=20network=20connections.=0A+=20= *=20Serial=20Ports::=20=20=20=20=20=20=20=20=20=20=20=20=20Communicating=20= with=20serial=20ports.=0A=20=20*=20Byte=20Packing::=20=20=20=20=20=20=20=20= =20=20=20=20=20Using=20bindat=20to=20pack=20and=20unpack=20binary=20= data.=0A=20=20@end=20menu=0A=20=20=0A***************=20were=20given=20to=20= the=20program.=0A***=20676,681=20****=0A---=20677,725=20----=0A=20=20= @end=20smallexample=0A=20=20@end=20defun=0A=20=20=0A+=20@defun=20= process-contact=20process=20&optional=20key=0A+=20=0A+=20This=20function=20= returns=20information=20about=20how=20a=20network=20or=20serial=0A+=20= process=20was=20set=20up.=20=20For=20a=20network=20process,=20when=20= @var{key}=20is=0A+=20@code{nil},=20it=20returns=20@code{(@var{hostname}=20= @var{service})}=20which=0A+=20specifies=20what=20you=20connected=20to.=20= =20For=20a=20serial=20process,=20when=20@var{key}=0A+=20is=20@code{nil},=20= it=20returns=20@code{(@var{port}=20@var{speed})}.=20=20For=20an=0A+=20= ordinary=20child=20process,=20this=20function=20always=20returns=20= @code{t}.=0A+=20=0A+=20If=20@var{key}=20is=20@code{t},=20the=20value=20= is=20the=20complete=20status=20information=0A+=20for=20the=20connection,=20= server,=20or=20serial=20port;=20that=20is,=20the=20list=20of=0A+=20= keywords=20and=20values=20specified=20in=20@code{make-network-process}=20= or=0A+=20@code{make-serial-process},=20except=20that=20some=20of=20the=20= values=20represent=0A+=20the=20current=20status=20instead=20of=20what=20= you=20specified.=0A+=20=0A+=20For=20a=20network=20process:=0A+=20=0A+=20= @table=20@code=0A+=20@item=20:buffer=0A+=20The=20associated=20value=20is=20= the=20process=20buffer.=0A+=20@item=20:filter=0A+=20The=20associated=20= value=20is=20the=20process=20filter=20function.=0A+=20@item=20:sentinel=0A= +=20The=20associated=20value=20is=20the=20process=20sentinel=20function.=0A= +=20@item=20:remote=0A+=20In=20a=20connection,=20the=20address=20in=20= internal=20format=20of=20the=20remote=20peer.=0A+=20@item=20:local=0A+=20= The=20local=20address,=20in=20internal=20format.=0A+=20@item=20:service=0A= +=20In=20a=20server,=20if=20you=20specified=20@code{t}=20for=20= @var{service},=0A+=20this=20value=20is=20the=20actual=20port=20number.=0A= +=20@end=20table=0A+=20=0A+=20@code{:local}=20and=20@code{:remote}=20are=20= included=20even=20if=20they=20were=20not=0A+=20specified=20explicitly=20= in=20@code{make-network-process}.=0A+=20=0A+=20For=20a=20serial=20= process,=20see=20@code{make-serial-process}=20and=0A+=20= @code{serial-process-configure}=20for=20a=20list=20of=20keys.=0A+=20=0A+=20= If=20@var{key}=20is=20a=20keyword,=20the=20function=20returns=20the=20= value=20corresponding=0A+=20to=20that=20keyword.=0A+=20@end=20defun=0A+=20= =0A=20=20@defun=20process-id=20process=0A=20=20This=20function=20returns=20= the=20@acronym{PID}=20of=20@var{process}.=20=20This=20is=20an=0A=20=20= integer=20that=20distinguishes=20the=20process=20@var{process}=20from=20= all=20other=0A***************=20For=20a=20network=20connection,=20= @code{process-=0A***=20742,747=20****=0A---=20786,797=20----=0A=20=20= closed=20the=20connection,=20or=20Emacs=20did=20@code{delete-process}.=0A= =20=20@end=20defun=0A=20=20=0A+=20@defun=20process-type=20process=0A+=20= This=20function=20returns=20the=20symbol=20@code{network}=20for=20a=20= network=0A+=20connection=20or=20server,=20@code{serial}=20for=20a=20= serial=20port=20connection,=20or=0A+=20@code{real}=20for=20a=20real=20= subprocess.=0A+=20@end=20defun=0A+=20=0A=20=20@defun=20= process-exit-status=20process=0A=20=20This=20function=20returns=20the=20= exit=20status=20of=20@var{process}=20or=20the=20signal=0A=20=20number=20= that=20killed=20it.=20=20(Use=20the=20result=20of=20= @code{process-status}=20to=0A***************=20server=20process,=20or=20= @code{:type=20'datagram=0A***=201593,1603=20****=0A=20=20connection.=20=20= @xref{Low-Level=20Network},=20for=20details.=20=20You=20can=20also=20use=0A= =20=20the=20@code{open-network-stream}=20function=20described=20below.=0A= =20=20=0A!=20=20=20You=20can=20distinguish=20process=20objects=20= representing=20network=20connections=0A!=20and=20servers=20from=20those=20= representing=20subprocesses=20with=20the=0A!=20@code{process-status}=20= function.=20=20The=20possible=20status=20values=20for=0A!=20network=20= connections=20are=20@code{open},=20@code{closed},=20@code{connect},=0A!=20= and=20@code{failed}.=20=20For=20a=20network=20server,=20the=20status=20= is=20always=0A=20=20@code{listen}.=20=20None=20of=20those=20values=20is=20= possible=20for=20a=20real=0A=20=20subprocess.=20=20@xref{Process=20= Information}.=0A=20=20=0A---=201643,1656=20----=0A=20=20connection.=20=20= @xref{Low-Level=20Network},=20for=20details.=20=20You=20can=20also=20use=0A= =20=20the=20@code{open-network-stream}=20function=20described=20below.=0A= =20=20=0A!=20=20=20To=20distinguish=20the=20different=20types=20of=20= processes,=20the=0A!=20@code{process-type}=20function=20returns=20the=20= symbol=20@code{network}=20for=20a=0A!=20network=20connection=20or=20= server,=20@code{serial}=20for=20a=20serial=20port=0A!=20connection,=20or=20= @code{real}=20for=20a=20real=20subprocess.=0A!=20=0A!=20=20=20The=20= @code{process-status}=20function=20returns=20@code{open},=0A!=20= @code{closed},=20@code{connect},=20and=20@code{failed}=20for=20network=0A= !=20connections.=20=20For=20a=20network=20server,=20the=20status=20is=20= always=0A=20=20@code{listen}.=20=20None=20of=20those=20values=20is=20= possible=20for=20a=20real=0A=20=20subprocess.=20=20@xref{Process=20= Information}.=0A=20=20=0A***************=20The=20arguments=20@var{host}=20= and=20@var{servic=0A***=201631,1672=20****=0A=20=20a=20defined=20network=20= service=20(a=20string)=20or=20a=20port=20number=20(an=20integer).=0A=20=20= @end=20defun=0A=20=20=0A-=20@defun=20process-contact=20process=20= &optional=20key=0A-=20This=20function=20returns=20information=20about=20= how=20a=20network=20process=20was=20set=0A-=20up.=20=20For=20a=20= connection,=20when=20@var{key}=20is=20@code{nil},=20it=20returns=0A-=20= @code{(@var{hostname}=20@var{service})}=20which=20specifies=20what=20you=0A= -=20connected=20to.=0A-=20=0A-=20If=20@var{key}=20is=20@code{t},=20the=20= value=20is=20the=20complete=20status=20information=0A-=20for=20the=20= connection=20or=20server;=20that=20is,=20the=20list=20of=20keywords=20= and=20values=0A-=20specified=20in=20@code{make-network-process},=20= except=20that=20some=20of=20the=0A-=20values=20represent=20the=20current=20= status=20instead=20of=20what=20you=20specified:=0A-=20=0A-=20@table=20= @code=0A-=20@item=20:buffer=0A-=20The=20associated=20value=20is=20the=20= process=20buffer.=0A-=20@item=20:filter=0A-=20The=20associated=20value=20= is=20the=20process=20filter=20function.=0A-=20@item=20:sentinel=0A-=20= The=20associated=20value=20is=20the=20process=20sentinel=20function.=0A-=20= @item=20:remote=0A-=20In=20a=20connection,=20the=20address=20in=20= internal=20format=20of=20the=20remote=20peer.=0A-=20@item=20:local=0A-=20= The=20local=20address,=20in=20internal=20format.=0A-=20@item=20:service=0A= -=20In=20a=20server,=20if=20you=20specified=20@code{t}=20for=20= @var{service},=0A-=20this=20value=20is=20the=20actual=20port=20number.=0A= -=20@end=20table=0A-=20=0A-=20@code{:local}=20and=20@code{:remote}=20are=20= included=20even=20if=20they=20were=20not=0A-=20specified=20explicitly=20= in=20@code{make-network-process}.=0A-=20=0A-=20If=20@var{key}=20is=20a=20= keyword,=20the=20function=20returns=20the=20value=20corresponding=0A-=20= to=20that=20keyword.=0A-=20=0A-=20For=20an=20ordinary=20child=20process,=20= this=20function=20always=20returns=20@code{t}.=0A-=20@end=20defun=0A-=20=0A= =20=20@node=20Network=20Servers=0A=20=20@section=20Network=20Servers=0A=20= =20@cindex=20network=20servers=0A---=201684,1689=20----=0A= ***************=20This=20function=20creates=20a=20network=20connecti=0A= ***=201772,1779=20****=0A=20=20process=20object=20that=20represents=20= it.=20=20The=20arguments=20@var{args}=20are=20a=0A=20=20list=20of=20= keyword/argument=20pairs.=20=20Omitting=20a=20keyword=20is=20always=0A=20= =20equivalent=20to=20specifying=20it=20with=20value=20@code{nil},=20= except=20for=0A!=20@code{:coding},=20@code{:filter-multibyte},=20and=20= @code{:reuseaddr}.=20=20Here=0A!=20are=20the=20meaningful=20keywords:=0A=20= =20=0A=20=20@table=20@asis=0A=20=20@item=20:name=20@var{name}=0A---=20= 1789,1796=20----=0A=20=20process=20object=20that=20represents=20it.=20=20= The=20arguments=20@var{args}=20are=20a=0A=20=20list=20of=20= keyword/argument=20pairs.=20=20Omitting=20a=20keyword=20is=20always=0A=20= =20equivalent=20to=20specifying=20it=20with=20value=20@code{nil},=20= except=20for=0A!=20@code{:coding}=20and=20@code{:reuseaddr}.=20=20Here=20= are=20the=20meaningful=0A!=20keywords:=0A=20=20=0A=20=20@table=20@asis=0A= =20=20@item=20:name=20@var{name}=0A***************=20Initialize=20the=20= process=20query=20flag=20to=20@va=0A***=201889,1900=20****=0A=20=20@item=20= :filter=20@var{filter}=0A=20=20Initialize=20the=20process=20filter=20to=20= @var{filter}.=0A=20=20=0A-=20@item=20:filter-multibyte=20@var{bool}=0A-=20= If=20@var{bool}=20is=20non-@code{nil},=20strings=20given=20to=20the=20= process=20filter=0A-=20are=20multibyte,=20otherwise=20they=20are=20= unibyte.=20=20If=20you=20don't=20specify=20this=0A-=20keyword=20at=20= all,=20the=20default=20is=20that=20the=20strings=20are=20multibyte=20if=0A= -=20@code{default-enable-multibyte-characters}=20is=20non-@code{nil}.=0A= -=20=0A=20=20@item=20:sentinel=20@var{sentinel}=0A=20=20Initialize=20the=20= process=20sentinel=20to=20@var{sentinel}.=0A=20=20=0A---=201906,1911=20= ----=0A***************=20If=20the=20vector=20does=20not=20include=20the=20= port=20=0A***=202099,2104=20****=0A---=202110,2298=20----=0A=20=20= @code{:@var{p}}=20suffix.=0A=20=20@end=20defun=0A=20=20=0A+=20@node=20= Serial=20Ports=0A+=20@section=20Communicating=20with=20Serial=20Ports=0A= +=20@cindex=20serial=20port=0A+=20@cindex=20/dev/tty=0A+=20@cindex=20tty=0A= +=20@cindex=20COM1=0A+=20=0A+=20=20=20Emacs=20can=20communicate=20with=20= serial=20ports=20directly,=20without=20external=0A+=20tools.=20=20For=20= interactive=20use,=20@kbd{M-x=20serial-term}=20opens=20a=20terminal=0A+=20= window.=20=20In=20a=20Lisp=20program,=20@code{make-serial-process}=20= creates=20a=0A+=20process=20object.=0A+=20=0A+=20=20=20The=20serial=20= port=20can=20be=20configured=20at=20run-time,=20without=20having=20to=0A= +=20close=20and=20re-open=20it.=20The=20function=20= @code{serial-process-configure}=0A+=20lets=20you=20change=20the=20speed,=20= bytesize,=20and=20other=20parameters.=20In=20a=0A+=20terminal=20window=20= created=20by=20@code{serial-term},=20you=20can=20use=20the=20mode=0A+=20= line=20menu=20for=20configuration.=0A+=20=0A+=20=20=20A=20serial=20= connection=20is=20represented=20by=20a=20process=20object=20which=20can=20= be=0A+=20used=20similar=20to=20a=20subprocess=20or=20network=20process.=20= =20You=20can=20send=20and=0A+=20receive=20data=20and=20configure=20the=20= serial=20port.=20=20A=20serial=20process=20object=0A+=20has=20no=20= process=20ID,=20and=20you=20can't=20send=20signals=20to=20it.=0A+=20= @code{delete-process}=20on=20the=20process=20object=20or=20= @code{kill-buffer}=20on=0A+=20the=20process=20buffer=20close=20the=20= connection,=20but=20this=20does=20not=20affect=20the=0A+=20device=20= connected=20to=20the=20serial=20port.=0A+=20=0A+=20=20=20The=20function=20= @code{process-type}=20returns=20the=20symbol=20@code{serial}=0A+=20for=20= a=20process=20object=20representing=20a=20serial=20port.=0A+=20=0A+=20=20= =20Serial=20ports=20are=20available=20on=20GNU/Linux,=20Unix,=20and=20= Windows=20systems.=0A+=20=0A+=20@defun=20serial-term=20port=20speed=0A+=20= Start=20a=20terminal-emulator=20for=20a=20serial=20port=20in=20a=20new=20= buffer.=0A+=20PORT=20is=20the=20path=20or=20name=20of=20the=20serial=20= port.=20=20For=20example,=20this=20could=0A+=20be=20"/dev/ttyS0"=20on=20= Unix.=20=20On=20Windows,=20this=20could=20be=20"COM1",=20or=0A+=20= "\\.\COM10"=20(double=20the=20quotes=20in=20strings).=0A+=20=0A+=20SPEED=20= is=20the=20speed=20of=20the=20serial=20port=20in=20bits=20per=20second.=20= =209600=20is=20a=0A+=20common=20value.=20=20The=20buffer=20is=20in=20= Term=20mode;=20see=20@code{term-mode}=20for=0A+=20the=20commands=20to=20= use=20in=20that=20buffer.=20=20You=20can=20change=20the=20speed=20and=20= the=0A+=20configuration=20in=20the=20mode=20line=20menu.=0A+=20@end=20= defun=0A+=20=0A+=20@defun=20make-serial-process=20&rest=20args=0A+=20= @code{make-serial-process}=20creates=20a=20process=20and=20a=20buffer.=20= =20Arguments=0A+=20are=20specified=20as=20keyword/argument=20pairs.=20=20= The=20following=20arguments=20are=0A+=20defined:=0A+=20=0A+=20@table=20= @asis=0A+=20@item=20:port=20@var{port}=0A+=20=0A+=20@var{PORT}=20= (mandatory)=20is=20the=20path=20or=20name=20of=20the=20serial=20port.=20=20= For=0A+=20example,=20this=20could=20be=20"/dev/ttyS0"=20on=20Unix.=20=20= On=20Windows,=20this=20could=0A+=20be=20"COM1",=20or=20"\\.\COM10"=20for=20= ports=20higher=20than=20COM9=20(double=20the=0A+=20backslashes=20in=20= strings).=0A+=20=0A+=20@item=20:speed=20@var{speed}=0A+=20@var{speed}=20= (mandatory)=20is=20handled=20by=20@code{serial-process-configure},=0A+=20= which=20is=20called=20by=20@code{make-serial-process}.=0A+=20=0A+=20= @item=20:name=20@var{name}=0A+=20@var{name}=20is=20the=20name=20of=20the=20= process.=20=20If=20@var{name}=20is=20not=20given,=20the=0A+=20value=20of=20= @var{port}=20is=20used.=0A+=20=0A+=20@item=20:buffer=20@var{buffer}=0A+=20= @var{buffer}=20is=20the=20buffer=20(or=20buffer-name)=20to=20associate=20= with=20the=0A+=20process.=20=20Process=20output=20goes=20at=20the=20end=20= of=20that=20buffer,=20unless=20you=0A+=20specify=20an=20output=20stream=20= or=20filter=20function=20to=20handle=20the=20output.=20=20If=0A+=20= @var{buffer}=20is=20not=20given,=20the=20value=20of=20@var{name}=20is=20= used.=0A+=20=0A+=20@item=20:coding=20@var{coding}=0A+=20If=20= @var{coding}=20is=20a=20symbol,=20it=20specifies=20the=20coding=20system=20= used=20for=0A+=20both=20reading=20and=20writing=20for=20this=20process.=20= =20If=20@var{coding}=20is=20a=20cons=0A+=20(@var{decoding}=20.=20= @var{encoding}),=20@var{decoding}=20is=20used=20for=20reading,=0A+=20and=20= @var{encoding}=20is=20used=20for=20writing.=0A+=20=0A+=20@item=20= :noquery=20@var{bool}=0A+=20When=20exiting=20Emacs,=20query=20the=20user=20= if=20@var{bool}=20is=20@code{nil}=20and=20the=0A+=20process=20is=20= running.=20=20If=20@var{bool}=20is=20not=20given,=20query=20before=20= exiting.=0A+=20=0A+=20@item=20:stop=20@var{bool}=0A+=20Start=20process=20= in=20the=20@code{stopped}=20state=20if=20@var{bool}=20is=0A+=20= non-@code{nil}.=20=20In=20the=20stopped=20state,=20a=20serial=20process=20= does=20not=0A+=20accept=20incoming=20data,=20but=20you=20can=20send=20= outgoing=20data.=20=20The=20stopped=0A+=20state=20is=20cleared=20by=20= @code{continue-process}=20and=20set=20by=0A+=20@code{stop-process}.=0A+=20= =0A+=20@item=20:filter=20@var{filter}=0A+=20Install=20@var{filter}=20as=20= the=20process=20filter.=0A+=20=0A+=20@item=20:sentinel=20@var{sentinel}=0A= +=20Install=20@var{sentinel}=20as=20the=20process=20sentinel.=0A+=20=0A+=20= @item=20:plist=20@var{plist}=0A+=20Install=20@var{plist}=20as=20the=20= initial=20plist=20of=20the=20process.=0A+=20=0A+=20@item=20:speed,=20= :bytesize,=20:parity,=20:stopbits,=20:flowcontrol=0A+=20=0A+=20These=20= arguments=20are=20handled=20by=20@code{serial-process-configure},=20= which=0A+=20is=20called=20by=20@code{make-serial-process}.=0A+=20@end=20= table=0A+=20=0A+=20The=20original=20argument=20list,=20possibly=20= modified=20by=20later=20configuration,=0A+=20is=20available=20via=20the=20= function=20@code{process-contact}.=0A+=20=0A+=20Examples:=0A+=20=0A+=20= (make-serial-process=20:port=20"/dev/ttyS0"=20:speed=209600)=0A+=20=0A+=20= (make-serial-process=20:port=20"COM1"=20:speed=20115200=20:stopbits=202)=0A= +=20=0A+=20(make-serial-process=20:port=20"\\\\.\\COM13"=20:speed=201200=20= :bytesize=207=20:parity=20'odd)=0A+=20=0A+=20(make-serial-process=20= :port=20"/dev/tty.BlueConsole-SPP-1"=20:speed=20nil)=0A+=20@end=20defun=0A= +=20=0A+=20@defun=20serial-process-configure=20&rest=20args=0A+=20= @cindex=20bps=0A+=20@cindex=20baud=0A+=20@cindex=20bytesize=0A+=20= @cindex=20parity=0A+=20@cindex=20stopbits=0A+=20@cindex=20flowcontrol=0A= +=20=0A+=20Configure=20a=20serial=20port.=20=20Arguments=20are=20= specified=20as=20keyword/argument=0A+=20pairs.=20=20Attributes=20that=20= are=20not=20given=20are=20re-initialized=20from=20the=0A+=20process's=20= current=20configuration=20(available=20via=20the=20function=0A+=20= @code{process-contact})=20or=20set=20to=20reasonable=20default=20values.=20= =20The=0A+=20following=20arguments=20are=20defined:=0A+=20=0A+=20@table=20= @asis=0A+=20@item=20:process=20@var{process},=20:name=20@var{name},=20= :buffer=20@var{buffer},=20:port=20@var{port}=0A+=20Any=20of=20these=20= arguments=20can=20be=20given=20to=20identify=20the=20process=20that=20is=20= to=0A+=20be=20configured.=20=20If=20none=20of=20these=20arguments=20is=20= given,=20the=20current=0A+=20buffer's=20process=20is=20used.=0A+=20=0A+=20= @item=20:speed=20@var{speed}=0A+=20@var{speed}=20is=20the=20speed=20of=20= the=20serial=20port=20in=20bits=20per=20second,=20also=0A+=20called=20= baud=20rate.=20=20Any=20value=20can=20be=20given=20for=20@var{speed},=20= but=20most=0A+=20serial=20ports=20work=20only=20at=20a=20few=20defined=20= values=20between=201200=20and=0A+=20115200,=20with=209600=20being=20the=20= most=20common=20value.=20=20If=20@var{speed}=20is=0A+=20@code{nil},=20= the=20serial=20port=20is=20not=20configured=20any=20further,=20i.e.=20= all=0A+=20other=20arguments=20are=20ignored.=20=20This=20may=20be=20= useful=20for=20special=20serial=0A+=20ports=20such=20as=20= Bluetooth-to-serial=20converters=20which=20can=20only=20be=0A+=20= configured=20through=20AT=20commands.=20=20A=20value=20of=20@code{nil}=20= for=20@var{speed}=0A+=20can=20be=20used=20only=20when=20passed=20through=20= @code{make-serial-process}=20or=0A+=20@code{serial-term}.=0A+=20=0A+=20= @item=20:bytesize=20@var{bytesize}=0A+=20@var{bytesize}=20is=20the=20= number=20of=20bits=20per=20byte,=20which=20can=20be=207=20or=208.=0A+=20= If=20@var{bytesize}=20is=20not=20given=20or=20@code{nil},=20a=20value=20= of=208=20is=20used.=0A+=20=0A+=20@item=20:parity=20@var{parity}=0A+=20= @var{parity}=20can=20be=20@code{nil}=20(don't=20use=20parity),=20the=20= symbol=0A+=20@code{odd}=20(use=20odd=20parity),=20or=20the=20symbol=20= @code{even}=20(use=20even=0A+=20parity).=20=20If=20@var{parity}=20is=20= not=20given,=20no=20parity=20is=20used.=0A+=20=0A+=20@item=20:stopbits=20= @var{stopbits}=0A+=20@var{stopbits}=20is=20the=20number=20of=20stop=20= bits=20used=20to=20terminate=20a=20byte=0A+=20transmission.=20=20= @var{stopbits}=20can=20be=201=20or=202.=20=20If=20@var{stopbits}=20is=20= not=0A+=20given=20or=20@code{nil},=201=20stop=20bit=20is=20used.=0A+=20=0A= +=20@item=20:flowcontrol=20@var{flowcontrol}=0A+=20@var{flowcontrol}=20= determines=20the=20type=20of=20flowcontrol=20to=20be=20used,=20which=0A+=20= is=20either=20@code{nil}=20(don't=20use=20flowcontrol),=20the=20symbol=20= @code{hw}=0A+=20(use=20RTS/CTS=20hardware=20flowcontrol),=20or=20the=20= symbol=20@code{sw}=20(use=0A+=20XON/XOFF=20software=20flowcontrol).=20=20= If=20@var{flowcontrol}=20is=20not=20given,=20no=0A+=20flowcontrol=20is=20= used.=0A+=20@end=20table=0A+=20=0A+=20@code{serial-process-configure}=20= is=20called=20by=20@code{make-serial-process}=20for=20the=0A+=20initial=20= configuration=20of=20the=20serial=20port.=0A+=20=0A+=20Examples:=0A+=20=0A= +=20(serial-process-configure=20:process=20"/dev/ttyS0"=20:speed=201200)=0A= +=20=0A+=20(serial-process-configure=0A+=20:buffer=20"COM1"=20:stopbits=20= 1=20:parity=20'odd=20:flowcontrol=20'hw)=0A+=20=0A+=20= (serial-process-configure=20:port=20"\\\\.\\COM13"=20:bytesize=207)=0A+=20= @end=20defun=0A+=20=0A=20=20@node=20Byte=20Packing=0A=20=20@section=20= Packing=20and=20Unpacking=20Byte=20Arrays=0A=20=20@cindex=20byte=20= packing=20and=20unpacking=0AIndex:=20doc/lispref/tips.texi=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/doc/lispref/tips.texi,v=0Aretrieving=20revision=20= 1.3=0Adiff=20-c=20-p=20-r1.3=20tips.texi=0A***=20doc/lispref/tips.texi=09= 8=20Jan=202008=2020:45:47=20-0000=091.3=0A---=20doc/lispref/tips.texi=09= 21=20Apr=202008=2019:55:51=20-0000=0A***************=20string.=20=20If=20= the=20symbol's=20name=20is=20@code{f=0A***=20688,696=20****=0A=20=20= ``Foo''=20(which=20is=20a=20different=20symbol).=0A=20=20=0A=20=20This=20= might=20appear=20to=20contradict=20the=20policy=20of=20writing=20= function=0A!=20argument=20values,=20but=20there=20is=20no=20real=20= contradiction;=20the=20argument=0A!=20@emph{value}=20is=20not=20the=20= same=20thing=20as=20the=20@emph{symbol}=20which=20the=0A!=20function=20= uses=20to=20hold=20the=20value.=0A=20=20=0A=20=20If=20this=20puts=20a=20= lower-case=20letter=20at=20the=20beginning=20of=20a=20sentence=0A=20=20= and=20that=20annoys=20you,=20rewrite=20the=20sentence=20so=20that=20the=20= symbol=0A---=20688,696=20----=0A=20=20``Foo''=20(which=20is=20a=20= different=20symbol).=0A=20=20=0A=20=20This=20might=20appear=20to=20= contradict=20the=20policy=20of=20writing=20function=0A!=20argument=20= values=20in=20capital=20letters,=20but=20there=20is=20no=20real=0A!=20= contradiction;=20the=20argument=20@emph{value}=20is=20not=20the=20same=20= thing=20as=20the=0A!=20@emph{symbol}=20which=20the=20function=20uses=20= to=20hold=20the=20value.=0A=20=20=0A=20=20If=20this=20puts=20a=20= lower-case=20letter=20at=20the=20beginning=20of=20a=20sentence=0A=20=20= and=20that=20annoys=20you,=20rewrite=20the=20sentence=20so=20that=20the=20= symbol=0AIndex:=20etc/DEBUG=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/etc/DEBUG,v=0Aretrieving=20revision=201.51=0Adiff=20= -c=20-p=20-r1.51=20DEBUG=0A***=20etc/DEBUG=091=20Mar=202008=2001:28:28=20= -0000=091.51=0A---=20etc/DEBUG=0921=20Apr=202008=2019:55:52=20-0000=0A= ***************=20thread,=20so=20this=20should=20only=20be=20a=20problem=0A= ***=20721,728=20****=0A=20=20threads.=0A=20=20=0A=20=20It=20is=20also=20= possible=20to=20keep=20appropriately=20masked=20and=20typecast=20Lisp=0A= !=20symbols=20in=20the=20Watch=20window,=20this=20is=20more=20convenient=20= when=20steeping=0A!=20though=20the=20code.=20=20For=20instance,=20on=20= entering=20apply_lambda,=20you=20can=0A=20=20watch=20(struct=20= Lisp_Symbol=20*)=20(0xfffffff=20&=20args[0]).=0A=20=20=0A=20=20= Optimizations=20often=20confuse=20the=20MS=20debugger.=20=20For=20= example,=20the=0A---=20721,728=20----=0A=20=20threads.=0A=20=20=0A=20=20= It=20is=20also=20possible=20to=20keep=20appropriately=20masked=20and=20= typecast=20Lisp=0A!=20symbols=20in=20the=20Watch=20window,=20this=20is=20= more=20convenient=20when=20stepping=0A!=20through=20the=20code.=20=20For=20= instance,=20on=20entering=20apply_lambda,=20you=20can=0A=20=20watch=20= (struct=20Lisp_Symbol=20*)=20(0xfffffff=20&=20args[0]).=0A=20=20=0A=20=20= Optimizations=20often=20confuse=20the=20MS=20debugger.=20=20For=20= example,=20the=0AIndex:=20lisp/term.el=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/lisp/term.el,v=0Aretrieving=20revision=201.100=0A= diff=20-c=20-p=20-r1.100=20term.el=0A***=20lisp/term.el=0910=20Apr=20= 2008=2014:09:43=20-0000=091.100=0A---=20lisp/term.el=0921=20Apr=202008=20= 19:56:02=20-0000=0A***************=20you=20type=20\\[term-send-input]=20= which=20sends=0A***=201277,1294=20****=0A=20=20=20=20=20=20= (term-update-mode-line)))=0A=20=20=0A=20=20(defun=20= term-update-mode-line=20()=0A!=20=20=20(setq=20mode-line-process=0A!=20=09= (if=20(term-in-char-mode)=0A!=20=09=20=20=20=20(if=20= (term-pager-enabled)=20'(":=20char=20page=20%s")=20'(":=20char=20%s"))=0A= !=20=09=20=20(if=20(term-pager-enabled)=20'(":=20line=20page=20%s")=20= '(":=20line=20%s"))))=0A=20=20=20=20(force-mode-line-update))=0A=20=20=0A= =20=20(defun=20term-check-proc=20(buffer)=0A!=20=20=20"True=20if=20there=20= is=20a=20process=20associated=20w/buffer=20BUFFER,=20and=0A!=20it=20is=20= alive=20(status=20RUN=20or=20STOP).=20=20BUFFER=20can=20be=20either=20a=20= buffer=20or=20the=0A!=20name=20of=20one."=0A=20=20=20=20(let=20((proc=20= (get-buffer-process=20buffer)))=0A!=20=20=20=20=20(and=20proc=20(memq=20= (process-status=20proc)=20'(run=20stop)))))=0A=20=20=0A=20=20= ;;;###autoload=0A=20=20(defun=20make-term=20(name=20program=20&optional=20= startfile=20&rest=20switches)=0A---=201277,1318=20----=0A=20=20=20=20=20=20= (term-update-mode-line)))=0A=20=20=0A=20=20(defun=20= term-update-mode-line=20()=0A!=20=20=20(let=20((term-mode=20(if=20= (term-in-char-mode)=20"char"=20"line"))=0A!=20=20=20=20=20=20=20=20=20= (term-page=20(when=20(term-pager-enabled)=20"=20page"))=0A!=20=20=20=20=20= =20=20=20=20(serial-item-speed)=0A!=20=20=20=20=20=20=20=20=20= (serial-item-config)=0A!=20=20=20=20=20=20=20=20=20(temp)=0A!=20=20=20=20= =20=20=20=20=20(proc=20(get-buffer-process=20(current-buffer))))=0A!=20=20= =20=20=20(when=20(and=20(term-check-proc=20(current-buffer))=0A!=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(equal=20(process-type=20nil)=20= 'serial))=0A!=20=20=20=20=20=20=20(let=20((temp=20(serial-speed)))=0A!=20= =20=20=20=20=20=20=20=20(setq=20serial-item-speed=0A!=20=20=20=20=20=20=20= =20=20=20=20=20=20`(:propertize=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20,(or=20(and=20temp=20(format=20"=20%d"=20temp))=20"")=0A!=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20help-echo=20"mouse-1:=20Change=20the=20= speed=20of=20the=20serial=20port"=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20mouse-face=20mode-line-highlight=0A!=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20local-map=20(keymap=20(mode-line=20keymap=0A!=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(down-mouse-1=20.=20serial-mode-line-speed-menu-1))))))=0A!=20=20= =20=20=20=20=20(let=20((temp=20(process-contact=20proc=20:summary)))=0A!=20= =20=20=20=20=20=20=20=20(setq=20serial-item-config=0A!=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20`(:propertize=0A!=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20,(or=20(and=20temp=20(format=20"=20%s"=20temp))=20"")=0A= !=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20help-echo=20= "mouse-1:=20Change=20the=20configuration=20of=20the=20serial=20port"=0A!=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20mouse-face=20= mode-line-highlight=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= local-map=20(keymap=20(mode-line=20keymap=0A!=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(down-mouse-1=20.=20= serial-mode-line-config-menu-1)))))))=0A!=20=20=20=20=20(setq=20= mode-line-process=0A!=20=20=20=20=20=20=20=20=20=20=20(list=20":=20"=20= term-mode=20term-page=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20serial-item-speed=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= serial-item-config=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "=20%s")))=0A=20=20=20=20(force-mode-line-update))=0A=20=20=0A=20=20= (defun=20term-check-proc=20(buffer)=0A!=20=20=20"True=20if=20there=20is=20= a=20process=20associated=20w/buffer=20BUFFER,=20and=20it=0A!=20is=20= alive.=20=20BUFFER=20can=20be=20either=20a=20buffer=20or=20the=20name=20= of=20one."=0A=20=20=20=20(let=20((proc=20(get-buffer-process=20buffer)))=0A= !=20=20=20=20=20(and=20proc=20(memq=20(process-status=20proc)=20'(run=20= stop=20open=20listen=20connect)))))=0A=20=20=0A=20=20;;;###autoload=0A=20= =20(defun=20make-term=20(name=20program=20&optional=20startfile=20&rest=20= switches)=0A***************=20the=20process.=20=20Any=20more=20args=20= are=20argument=0A***=204201,4206=20****=0A---=204225,4454=20----=0A=20=20= =20=20(switch-to-buffer=20term-ansi-buffer-name))=0A=20=20=0A=20=20=0C=0A= +=20;;;=20Serial=20terminals=0A+=20;;;=20= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =0A+=20(defun=20serial-port-is-file-p=20()=0A+=20=20=20"Guess=20whether=20= serial=20ports=20are=20files=20on=20this=20system.=0A+=20Return=20t=20if=20= this=20is=20a=20Unix-based=20system,=20where=20serial=20ports=20are=0A+=20= files,=20such=20as=20/dev/ttyS0.=0A+=20Return=20nil=20if=20this=20is=20= Windows=20or=20DOS,=20where=20serial=20ports=20have=0A+=20special=20= identifiers=20such=20as=20COM1."=0A+=20=20=20(not=20(member=20= system-type=20(list=20'windows-nt=20'ms-dos))))=0A+=20=0A+=20(defvar=20= serial-name-history=0A+=20=20=20(if=20(serial-port-is-file-p)=0A+=20=20=20= =20=20=20=20(or=20(when=20(file-exists-p=20"/dev/ttys0")=20(list=20= "/dev/ttys0"))=0A+=20=20=20=20=20=20=20=20=20=20=20(when=20= (file-exists-p=20"/dev/ttyS0")=20(list=20"/dev/ttyS0")))=0A+=20=20=20=20=20= (list=20"COM1"))=0A+=20=20=20"History=20of=20serial=20ports=20used=20by=20= `serial-read-name'.")=0A+=20=0A+=20(defvar=20serial-speed-history=0A+=20=20= =20;;=20Initialised=20with=20reasonable=20values=20for=20newbies.=0A+=20=20= =20(list=20"9600"=20;;=20Given=20twice=20because=209600=20b/s=20is=20the=20= most=20common=20speed=0A+=20=20=20=20=20=20=20=20=20"1200"=20"2400"=20= "4800"=20"9600"=20"14400"=20"19200"=0A+=20=20=20=20=20=20=20=20=20= "28800"=20"38400"=20"57600"=20"115200")=0A+=20=20=20"History=20of=20= serial=20port=20speeds=20used=20by=20`serial-read-speed'.")=0A+=20=0A+=20= (defun=20serial-nice-speed-history=20()=0A+=20=20=20"Return=20= `serial-speed-history'=20cleaned=20up=20for=20a=20mouse-menu."=0A+=20=20=20= (let=20((x)=20(y))=0A+=20=20=20=20=20(setq=20x=0A+=20=20=20=20=20=20=20=20= =20=20(sort=0A+=20=20=20=20=20=20=20=20=20=20=20(copy-sequence=20= serial-speed-history)=0A+=20=20=20=20=20=20=20=20=20=20=20'(lambda=20(a=20= b)=20(when=20(and=20(stringp=20a)=20(stringp=20b))=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(>=20= (string-to-number=20a)=20(string-to-number=20b))))))=0A+=20=20=20=20=20= (dolist=20(i=20x)=20(when=20(not=20(equal=20i=20(car=20y)))=20(push=20i=20= y)))=0A+=20=20=20=20=20y))=0A+=20=0A+=20(defconst=20serial-no-speed=20= "nil"=0A+=20=20=20"String=20for=20`serial-read-speed'=20for=20special=20= serial=20ports.=0A+=20If=20`serial-read-speed'=20reads=20this=20string=20= from=20the=20user,=20it=0A+=20returns=20nil,=20which=20is=20recognized=20= by=20`serial-process-configure'=0A+=20for=20special=20serial=20ports=20= that=20cannot=20be=20configured.")=0A+=20=0A+=20(defun=20= serial-read-name=20()=0A+=20=20=20"Read=20a=20serial=20port=20name=20= from=20the=20user.=0A+=20Try=20to=20be=20nice=20by=20providing=20useful=20= defaults=20and=20history.=0A+=20On=20Windows,=20prepend=20\\.\=20to=20= the=20port=20name=20unless=20it=20already=0A+=20contains=20a=20= backslash.=20This=20handles=20the=20legacy=20ports=20COM1-COM9=20as=0A+=20= well=20as=20the=20newer=20ports=20COM10=20and=20higher."=0A+=20=20=20= (let*=20((file-name-history=20serial-name-history)=0A+=20=20=20=20=20=20=20= =20=20=20(h=20(car=20file-name-history))=0A+=20=20=20=20=20=20=20=20=20=20= (x=20(if=20(serial-port-is-file-p)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(read-file-name=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20;;=20`prompt':=20The=20most=20recently=20used=20port=20is=20= provided=20as=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ;;=20the=20default=20value,=20which=20is=20used=20when=20the=20user=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20simply=20presses=20= return.=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20= (stringp=20h)=20(format=20"Serial=20port=20(default=20%s):=20"=20h)=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"Serial=20port:=20= ")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20= `directory':=20Most=20systems=20have=20their=20serial=20ports=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20in=20the=20same=20= directory,=20so=20start=20in=20the=20directory=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20;;=20of=20the=20most=20recently=20used=20= port,=20or=20in=20a=20reasonable=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20;;=20default=20directory.=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(or=20(and=20h=20(file-name-directory=20h))=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(and=20= (file-exists-p=20"/dev/")=20"/dev/")=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(and=20(file-exists-p=20"/")=20"/"))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20`default':=20= This=20causes=20(read-file-name)=20to=20return=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20;;=20the=20empty=20string=20if=20he=20user=20= simply=20presses=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ;;=20return.=20Using=20nil=20here=20may=20result=20in=20a=20default=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20directory=20of=20= the=20current=20buffer,=20which=20is=20not=20useful=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20;;=20for=20serial=20port.=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"")=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(read-from-minibuffer=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(if=20(stringp=20h)=20(format=20"Serial=20port=20= (default=20%s):=20"=20h)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20"Serial=20port:=20")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20nil=20nil=20nil=20'(file-name-history=20.=201)=20nil=20nil))))=0A+=20= =20=20=20=20(if=20(or=20(null=20x)=20(and=20(stringp=20x)=20(zerop=20= (length=20x))))=0A+=20=20=20=20=20=20=20=20=20(setq=20x=20h)=0A+=20=20=20= =20=20=20=20(setq=20serial-name-history=20file-name-history))=0A+=20=20=20= =20=20(when=20(or=20(null=20x)=20(and=20(stringp=20x)=20(zerop=20(length=20= x))))=0A+=20=20=20=20=20=20=20(error=20"No=20serial=20port=20selected"))=0A= +=20=20=20=20=20(when=20(and=20(not=20(serial-port-is-file-p))=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(not=20(string-match=20"\\\\"=20= x)))=0A+=20=20=20=20=20=20=20(set=20'x=20(concat=20"\\\\.\\"=20x)))=0A+=20= =20=20=20=20x))=0A+=20=0A+=20(defun=20serial-read-speed=20()=0A+=20=20=20= "Read=20a=20serial=20port=20speed=20(in=20bits=20per=20second)=20from=20= the=20user.=0A+=20Try=20to=20be=20nice=20by=20providing=20useful=20= defaults=20and=20history."=0A+=20=20=20(let*=20((history=20= serial-speed-history)=0A+=20=20=20=20=20=20=20=20=20=20(h=20(car=20= history))=0A+=20=20=20=20=20=20=20=20=20=20(x=20(read-from-minibuffer=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20(cond=20((string=3D=20h=20= serial-no-speed)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20"Speed=20(default=20nil=20=3D=20set=20by=20port):=20")=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(h=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(format=20"Speed=20= (default=20%s=20b/s):=20"=20h))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(t=0A+=20=09=09=20=20=20=20(format=20"Speed=20= (b/s):=20")))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20nil=20nil=20= nil=20'(history=20.=201)=20nil=20nil)))=0A+=20=20=20=20=20(when=20(or=20= (null=20x)=20(and=20(stringp=20x)=20(zerop=20(length=20x))))=0A+=20=20=20= =20=20=20=20(setq=20x=20h))=0A+=20=20=20=20=20(when=20(or=20(null=20x)=20= (not=20(stringp=20x))=20(zerop=20(length=20x)))=0A+=20=20=20=20=20=20=20= (error=20"Invalid=20speed"))=0A+=20=20=20=20=20(if=20(string=3D=20x=20= serial-no-speed)=0A+=20=20=20=20=20=20=20=20=20(setq=20x=20nil)=0A+=20=20= =20=20=20=20=20(setq=20x=20(string-to-number=20x))=0A+=20=20=20=20=20=20=20= (when=20(or=20(null=20x)=20(not=20(integerp=20x))=20(<=3D=20x=200))=0A+=20= =20=20=20=20=20=20=20=20(error=20"Invalid=20speed")))=0A+=20=20=20=20=20= (setq=20serial-speed-history=20history)=0A+=20=20=20=20=20x))=0A+=20=0A+=20= ;;;###autoload=0A+=20(defun=20serial-term=20(port=20speed)=0A+=20=20=20= "Start=20a=20terminal-emulator=20for=20a=20serial=20port=20in=20a=20new=20= buffer.=0A+=20PORT=20is=20the=20path=20or=20name=20of=20the=20serial=20= port.=20=20For=20example,=20this=0A+=20could=20be=20\"/dev/ttyS0\"=20on=20= Unix.=20=20On=20Windows,=20this=20could=20be=0A+=20\"COM1\"=20or=20= \"\\\\.\\COM10\".=0A+=20SPEED=20is=20the=20speed=20of=20the=20serial=20= port=20in=20bits=20per=20second.=20=209600=0A+=20is=20a=20common=20= value.=20=20SPEED=20can=20be=20nil,=20see=0A+=20= `serial-process-configure'=20for=20details.=0A+=20The=20buffer=20is=20in=20= Term=20mode;=20see=20`term-mode'=20for=20the=20commands=20to=0A+=20use=20= in=20that=20buffer.=0A+=20\\Type=20\\[switch-to-buffer]=20= to=20switch=20to=20another=20buffer.=20"=0A+=20=20=20(interactive=20= (list=20(serial-read-name)=20(serial-read-speed)))=0A+=20=20=20(let*=20= ((process=20(make-serial-process=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20:port=20port=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20:speed=20speed=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20:coding=20'no-conversion=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20:noquery=20t))=0A+=20=20=20=20=20= =20=20=20=20=20(buffer=20(process-buffer=20process)))=0A+=20=20=20=20=20= (save-excursion=0A+=20=20=20=20=20=20=20(set-buffer=20buffer)=0A+=20=20=20= =20=20=20=20(term-mode)=0A+=20=20=20=20=20=20=20(term-char-mode)=0A+=20=20= =20=20=20=20=20(goto-char=20(point-max))=0A+=20=20=20=20=20=20=20= (set-marker=20(process-mark=20process)=20(point))=0A+=20=20=20=20=20=20=20= (set-process-filter=20process=20'term-emulate-terminal)=0A+=20=20=20=20=20= =20=20(set-process-sentinel=20process=20'term-sentinel))=0A+=20=20=20=20=20= (switch-to-buffer=20buffer)=0A+=20=20=20=20=20buffer))=0A+=20=0A+=20= (defvar=20serial-mode-line-speed-menu=20nil)=0A+=20(defvar=20= serial-mode-line-config-menu=20nil)=0A+=20=0A+=20(defun=20serial-speed=20= ()=0A+=20=20=20"Return=20the=20speed=20of=20the=20serial=20port=20of=20= the=20current=20buffer's=20process.=0A+=20The=20return=20value=20may=20= be=20nil=20for=20a=20special=20serial=20port."=0A+=20=20=20= (process-contact=20(get-buffer-process=20(current-buffer))=20:speed))=0A= +=20=0A+=20(defun=20serial-mode-line-speed-menu-1=20(event)=0A+=20=20=20= (interactive=20"e")=0A+=20=20=20(save-selected-window=0A+=20=20=20=20=20= (select-window=20(posn-window=20(event-start=20event)))=0A+=20=20=20=20=20= (serial-update-speed-menu)=0A+=20=20=20=20=20(let*=20((selection=20= (serial-mode-line-speed-menu=20event))=0A+=20=09=20=20=20(binding=20(and=20= selection=20(lookup-key=20serial-mode-line-speed-menu=0A+=20=09=09=09=09=09= =20=20=20=20=20=20=20(vector=20(car=20selection))))))=0A+=20=20=20=20=20=20= =20(when=20binding=20(call-interactively=20binding)))))=0A+=20=0A+=20= (defun=20serial-mode-line-speed-menu=20(event)=0A+=20=20=20(x-popup-menu=20= event=20serial-mode-line-speed-menu))=0A+=20=0A+=20(defun=20= serial-update-speed-menu=20()=0A+=20=20=20(setq=20= serial-mode-line-speed-menu=20(make-sparse-keymap=20"Speed=20(b/s)"))=0A= +=20=20=20(define-key=20serial-mode-line-speed-menu=20= [serial-mode-line-speed-menu-other]=0A+=20=20=20=20=20'(menu-item=20= "Other..."=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(lambda=20= (event)=20(interactive=20"e")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(let=20((speed=20(serial-read-speed)))=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(serial-process-configure=20= :speed=20speed)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(term-update-mode-line)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(message=20"Speed=20set=20to=20%d=20b/s"=20= speed)))))=0A+=20=20=20(dolist=20(str=20(serial-nice-speed-history))=0A+=20= =20=20=20=20(let=20((num=20(or=20(and=20(stringp=20str)=20= (string-to-number=20str))=200)))=0A+=20=20=20=20=20=20=20(define-key=0A+=20= =20=20=20=20=20=20=20=20serial-mode-line-speed-menu=0A+=20=20=20=20=20=20= =20=20=20(vector=20(make-symbol=20(format=20= "serial-mode-line-speed-menu-%s"=20str)))=0A+=20=20=20=20=20=20=20=20=20= `(menu-item=0A+=20=20=20=20=20=20=20=20=20=20=20,str=0A+=20=20=20=20=20=20= =20=20=20=20=20(lambda=20(event)=20(interactive=20"e")=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20(serial-process-configure=20:speed=20,num)=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20(term-update-mode-line)=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20(message=20"Speed=20set=20to=20%d=20b/s"=20= ,num))=0A+=20=20=20=20=20=20=20=20=20=20=20:button=20(:toggle=20.=20(=3D=20= (serial-speed)=20,num)))))))=0A+=20=0A+=20(defun=20= serial-mode-line-config-menu-1=20(event)=0A+=20=20=20(interactive=20"e")=0A= +=20=20=20(save-selected-window=0A+=20=20=20=20=20(select-window=20= (posn-window=20(event-start=20event)))=0A+=20=20=20=20=20= (serial-update-config-menu)=0A+=20=20=20=20=20(let*=20((selection=20= (serial-mode-line-config-menu=20event))=0A+=20=20=20=20=20=20=20=20=20=20= =20=20(binding=20(and=20selection=20(lookup-key=20= serial-mode-line-config-menu=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(vector=20(car=20selection))))))=0A+=20=20=20=20= =20=20=20(when=20binding=20(call-interactively=20binding)))))=0A+=20=0A+=20= (defun=20serial-mode-line-config-menu=20(event)=0A+=20=20=20= (x-popup-menu=20event=20serial-mode-line-config-menu))=0A+=20=0A+=20= (defun=20serial-update-config-menu=20()=0A+=20=20=20(setq=20= serial-mode-line-config-menu=20(make-sparse-keymap=20"Configuration"))=0A= +=20=20=20(let=20((config=20(process-contact=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(get-buffer-process=20(current-buffer))=20t))=0A= +=20=20=20=20=20=20=20=20=20(y)=0A+=20=20=20=20=20=20=20=20=20(str))=0A+=20= =20=20=20=20(dolist=20(y=20'((:flowcontrol=20hw=20=20=20"Hardware=20= flowcontrol=20(RTS/CTS)")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(:flowcontrol=20sw=20=20=20"Software=20flowcontrol=20= (XON/XOFF)")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (:flowcontrol=20nil=20=20"No=20flowcontrol")=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(:stopbits=20=20=20=202=20=20=20=20"2=20stop=20= bits")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (:stopbits=20=20=20=201=20=20=20=20"1=20stop=20bit")=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(:parity=20=20=20=20=20=20odd=20=20= "Odd=20parity")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (:parity=20=20=20=20=20=20even=20"Even=20parity")=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(:parity=20=20=20=20=20=20nil=20=20"No=20= parity")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (:bytesize=20=20=20=207=20=20=20=20"7=20bits=20per=20byte")=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(:bytesize=20=20=20=208=20=20=20= =20"8=20bits=20per=20byte")))=0A+=20=20=20=20=20=20=20(define-key=20= serial-mode-line-config-menu=0A+=20=20=20=20=20=20=20=20=20(vector=20= (make-symbol=20(format=20"%s-%s"=20(nth=200=20y)=20(nth=201=20y))))=0A+=20= =20=20=20=20=20=20=20=20`(menu-item=0A+=20=20=20=20=20=20=20=20=20=20=20= ,(nth=202=20y)=0A+=20=20=20=20=20=20=20=20=20=20=20(lambda=20(event)=20= (interactive=20"e")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= (serial-process-configure=20,(nth=200=20y)=20',(nth=201=20y))=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20(term-update-mode-line)=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20(message=20"%s"=20,(nth=202=20y)))=0A+=20=20=20=20=20= =20=20=20=20=20=20;;=20Use=20:toggle=20instead=20of=20:radio=20because=20= a=20non-standard=20port=0A+=20=20=20=20=20=20=20=20=20=20=20;;=20= configuration=20may=20not=20match=20any=20menu=20items.=0A+=20=20=20=20=20= =20=20=20=20=20=20:button=20(:toggle=20.=20,(equal=20(plist-get=20config=20= (nth=200=20y))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(nth=201=20= y))))))))=0A+=20=0A+=20=0C=0A=20=20;;;=20Converting=20process=20modes=20= to=20use=20term=20mode=0A=20=20;;;=20= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =0A=20=20;;;=20Renaming=20variables=0AIndex:=20src/buffer.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/src/buffer.c,v=0Aretrieving=20revision=201.557=0A= diff=20-c=20-p=20-r1.557=20buffer.c=0A***=20src/buffer.c=092=20Apr=20= 2008=2020:15:11=20-0000=091.557=0A---=20src/buffer.c=0921=20Apr=202008=20= 19:56:10=20-0000=0A***************=20current=20buffer=20is=20cleared.=20=20= */)=0A***=202398,2404=20****=0A=20=20=09=20=20=20=20{=0A=20=20=09=20=20=20= =20=20=20c=20=3D=20STRING_CHAR_AND_LENGTH=20(p,=20stop=20-=20pos,=20= bytes);=0A=20=20=09=20=20=20=20=20=20/*=20Delete=20all=20bytes=20for=20= this=208-bit=20character=20but=20the=0A!=20=09=09=20last=20one,=20and=20= change=20the=20last=20one=20to=20the=20charcter=0A=20=20=09=09=20code.=20= =20*/=0A=20=20=09=20=20=20=20=20=20bytes--;=0A=20=20=09=20=20=20=20=20=20= del_range_2=20(pos,=20pos,=20pos=20+=20bytes,=20pos=20+=20bytes,=200);=0A= ---=202398,2404=20----=0A=20=20=09=20=20=20=20{=0A=20=20=09=20=20=20=20=20= =20c=20=3D=20STRING_CHAR_AND_LENGTH=20(p,=20stop=20-=20pos,=20bytes);=0A=20= =20=09=20=20=20=20=20=20/*=20Delete=20all=20bytes=20for=20this=208-bit=20= character=20but=20the=0A!=20=09=09=20last=20one,=20and=20change=20the=20= last=20one=20to=20the=20character=0A=20=20=09=09=20code.=20=20*/=0A=20=20= =09=20=20=20=20=20=20bytes--;=0A=20=20=09=20=20=20=20=20=20del_range_2=20= (pos,=20pos,=20pos=20+=20bytes,=20pos=20+=20bytes,=200);=0AIndex:=20= src/process.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/src/process.c,v=0Aretrieving=20revision=201.539=0A= diff=20-c=20-p=20-r1.539=20process.c=0A***=20src/process.c=099=20Apr=20= 2008=2006:46:39=20-0000=091.539=0A---=20src/process.c=0921=20Apr=202008=20= 19:56:19=20-0000=0A***************=20Lisp_Object=20Qprocessp;=0A***=20= 138,146=20****=0A---=20138,150=20----=0A=20=20Lisp_Object=20Qrun,=20= Qstop,=20Qsignal;=0A=20=20Lisp_Object=20Qopen,=20Qclosed,=20Qconnect,=20= Qfailed,=20Qlisten;=0A=20=20Lisp_Object=20Qlocal,=20Qipv4,=20Qdatagram;=0A= +=20Lisp_Object=20Qreal,=20Qnetwork,=20Qserial;=0A=20=20#ifdef=20= AF_INET6=0A=20=20Lisp_Object=20Qipv6;=0A=20=20#endif=0A+=20Lisp_Object=20= QCport,=20QCspeed,=20QCprocess;=0A+=20Lisp_Object=20QCbytesize,=20= QCstopbits,=20QCparity,=20Qodd,=20Qeven;=0A+=20Lisp_Object=20= QCflowcontrol,=20Qhw,=20Qsw,=20QCsummary;=0A=20=20Lisp_Object=20QCname,=20= QCbuffer,=20QChost,=20QCservice,=20QCtype;=0A=20=20Lisp_Object=20= QClocal,=20QCremote,=20QCcoding;=0A=20=20Lisp_Object=20QCserver,=20= QCnowait,=20QCnoquery,=20QCstop;=0A***************=20extern=20= Lisp_Object=20QCfamily;=0A***=20157,171=20****=0A=20=20/*=20QCfilter=20= is=20defined=20in=20keyboard.c.=20=20*/=0A=20=20extern=20Lisp_Object=20= QCfilter;=0A=20=20=0A-=20/*=20a=20process=20object=20is=20a=20network=20= connection=20when=20its=20childp=20field=20is=20neither=0A-=20=20=20=20= Qt=20nor=20Qnil=20but=20is=20instead=20a=20property=20list=20(KEY=20VAL=20= ...).=20=20*/=0A-=20=0A=20=20#ifdef=20HAVE_SOCKETS=0A!=20#define=20= NETCONN_P(p)=20(CONSP=20(XPROCESS=20(p)->childp))=0A!=20#define=20= NETCONN1_P(p)=20(CONSP=20((p)->childp))=0A=20=20#else=0A=20=20#define=20= NETCONN_P(p)=200=0A=20=20#define=20NETCONN1_P(p)=200=0A=20=20#endif=20/*=20= HAVE_SOCKETS=20*/=0A=20=20=0A=20=20/*=20Define=20first=20descriptor=20= number=20available=20for=20subprocesses.=20=20*/=0A---=20161,176=20----=0A= =20=20/*=20QCfilter=20is=20defined=20in=20keyboard.c.=20=20*/=0A=20=20= extern=20Lisp_Object=20QCfilter;=0A=20=20=0A=20=20#ifdef=20HAVE_SOCKETS=0A= !=20#define=20NETCONN_P(p)=20(EQ=20(XPROCESS=20(p)->type,=20Qnetwork))=0A= !=20#define=20NETCONN1_P(p)=20(EQ=20((p)->type,=20Qnetwork))=0A!=20= #define=20SERIALCONN_P(p)=20(EQ=20(XPROCESS=20(p)->type,=20Qserial))=0A!=20= #define=20SERIALCONN1_P(p)=20(EQ=20((p)->type,=20Qserial))=0A=20=20#else=0A= =20=20#define=20NETCONN_P(p)=200=0A=20=20#define=20NETCONN1_P(p)=200=0A+=20= #define=20SERIALCONN_P(p)=200=0A+=20#define=20SERIALCONN1_P(p)=200=0A=20=20= #endif=20/*=20HAVE_SOCKETS=20*/=0A=20=20=0A=20=20/*=20Define=20first=20= descriptor=20number=20available=20for=20subprocesses.=20=20*/=0A= ***************=20nil,=20indicating=20the=20current=20buffer's=20pro=0A= ***=20786,792=20****=0A=20=20=20=20p=20=3D=20XPROCESS=20(process);=0A=20=20= =0A=20=20=20=20p->raw_status_new=20=3D=200;=0A!=20=20=20if=20(NETCONN1_P=20= (p))=0A=20=20=20=20=20=20{=0A=20=20=20=20=20=20=20=20p->status=20=3D=20= Fcons=20(Qexit,=20Fcons=20(make_number=20(0),=20Qnil));=0A=20=20=20=20=20= =20=20=20p->tick=20=3D=20++process_tick;=0A---=20791,797=20----=0A=20=20=20= =20p=20=3D=20XPROCESS=20(process);=0A=20=20=0A=20=20=20=20= p->raw_status_new=20=3D=200;=0A!=20=20=20if=20(NETCONN1_P=20(p)=20||=20= SERIALCONN1_P=20(p))=0A=20=20=20=20=20=20{=0A=20=20=20=20=20=20=20=20= p->status=20=3D=20Fcons=20(Qexit,=20Fcons=20(make_number=20(0),=20= Qnil));=0A=20=20=20=20=20=20=20=20p->tick=20=3D=20++process_tick;=0A= ***************=20nil,=20indicating=20the=20current=20buffer's=20pro=0A= ***=20863,869=20****=0A=20=20=20=20status=20=3D=20p->status;=0A=20=20=20=20= if=20(CONSP=20(status))=0A=20=20=20=20=20=20status=20=3D=20XCAR=20= (status);=0A!=20=20=20if=20(NETCONN1_P=20(p))=0A=20=20=20=20=20=20{=0A=20= =20=20=20=20=20=20=20if=20(EQ=20(status,=20Qexit))=0A=20=20=09status=20=3D= =20Qclosed;=0A---=20868,874=20----=0A=20=20=20=20status=20=3D=20= p->status;=0A=20=20=20=20if=20(CONSP=20(status))=0A=20=20=20=20=20=20= status=20=3D=20XCAR=20(status);=0A!=20=20=20if=20(NETCONN1_P=20(p)=20||=20= SERIALCONN1_P=20(p))=0A=20=20=20=20=20=20{=0A=20=20=20=20=20=20=20=20if=20= (EQ=20(status,=20Qexit))=0A=20=20=09status=20=3D=20Qclosed;=0A= ***************=20DEFUN=20("process-command",=20Fprocess_comma=0A***=20= 921,927=20****=0A=20=20=20=20=20=20=20=20=20doc:=20/*=20Return=20the=20= command=20that=20was=20executed=20to=20start=20PROCESS.=0A=20=20This=20= is=20a=20list=20of=20strings,=20the=20first=20string=20being=20the=20= program=20executed=0A=20=20and=20the=20rest=20of=20the=20strings=20being=20= the=20arguments=20given=20to=20it.=0A!=20For=20a=20non-child=20channel,=20= this=20is=20nil.=20=20*/)=0A=20=20=20=20=20=20=20(process)=0A=20=20=20=20= =20=20=20register=20Lisp_Object=20process;=0A=20=20{=0A---=20926,933=20= ----=0A=20=20=20=20=20=20=20=20=20doc:=20/*=20Return=20the=20command=20= that=20was=20executed=20to=20start=20PROCESS.=0A=20=20This=20is=20a=20= list=20of=20strings,=20the=20first=20string=20being=20the=20program=20= executed=0A=20=20and=20the=20rest=20of=20the=20strings=20being=20the=20= arguments=20given=20to=20it.=0A!=20For=20a=20network=20or=20serial=20= process,=20this=20is=20nil=20(process=20is=20running)=20or=20t=0A!=20= \(process=20is=20stopped).=20=20*/)=0A=20=20=20=20=20=20=20(process)=0A=20= =20=20=20=20=20=20register=20Lisp_Object=20process;=0A=20=20{=0A= ***************=20DEFUN=20("set-process-buffer",=20Fset_proces=0A***=20= 953,959=20****=0A=20=20=20=20=20=20CHECK_BUFFER=20(buffer);=0A=20=20=20=20= p=20=3D=20XPROCESS=20(process);=0A=20=20=20=20p->buffer=20=3D=20buffer;=0A= !=20=20=20if=20(NETCONN1_P=20(p))=0A=20=20=20=20=20=20p->childp=20=3D=20= Fplist_put=20(p->childp,=20QCbuffer,=20buffer);=0A=20=20=20=20= setup_process_coding_systems=20(process);=0A=20=20=20=20return=20buffer;=0A= ---=20959,965=20----=0A=20=20=20=20=20=20CHECK_BUFFER=20(buffer);=0A=20=20= =20=20p=20=3D=20XPROCESS=20(process);=0A=20=20=20=20p->buffer=20=3D=20= buffer;=0A!=20=20=20if=20(NETCONN1_P=20(p)=20||=20SERIALCONN1_P=20(p))=0A= =20=20=20=20=20=20p->childp=20=3D=20Fplist_put=20(p->childp,=20QCbuffer,=20= buffer);=0A=20=20=20=20setup_process_coding_systems=20(process);=0A=20=20= =20=20return=20buffer;=0A***************=20The=20string=20argument=20is=20= normally=20a=20multib=0A***=201020,1026=20****=0A=20=20=09=20=20FD_CLR=20= (p->infd,=20&non_keyboard_wait_mask);=0A=20=20=09}=0A=20=20=20=20=20=20=20= =20else=20if=20(EQ=20(p->filter,=20Qt)=0A!=20=09=20=20=20=20=20=20=20&&=20= !EQ=20(p->command,=20Qt))=20/*=20Network=20process=20not=20stopped.=20*/=0A= =20=20=09{=0A=20=20=09=20=20FD_SET=20(p->infd,=20&input_wait_mask);=0A=20= =20=09=20=20FD_SET=20(p->infd,=20&non_keyboard_wait_mask);=0A---=20= 1026,1033=20----=0A=20=20=09=20=20FD_CLR=20(p->infd,=20= &non_keyboard_wait_mask);=0A=20=20=09}=0A=20=20=20=20=20=20=20=20else=20= if=20(EQ=20(p->filter,=20Qt)=0A!=20=09=20=20=20=20=20=20=20/*=20Network=20= or=20serial=20process=20not=20stopped:=20*/=0A!=20=09=20=20=20=20=20=20=20= &&=20!EQ=20(p->command,=20Qt))=0A=20=20=09{=0A=20=20=09=20=20FD_SET=20= (p->infd,=20&input_wait_mask);=0A=20=20=09=20=20FD_SET=20(p->infd,=20= &non_keyboard_wait_mask);=0A***************=20The=20string=20argument=20= is=20normally=20a=20multib=0A***=201028,1034=20****=0A=20=20=20=20=20=20= }=0A=20=20=0A=20=20=20=20p->filter=20=3D=20filter;=0A!=20=20=20if=20= (NETCONN1_P=20(p))=0A=20=20=20=20=20=20p->childp=20=3D=20Fplist_put=20= (p->childp,=20QCfilter,=20filter);=0A=20=20=20=20= setup_process_coding_systems=20(process);=0A=20=20=20=20return=20filter;=0A= ---=201035,1041=20----=0A=20=20=20=20=20=20}=0A=20=20=0A=20=20=20=20= p->filter=20=3D=20filter;=0A!=20=20=20if=20(NETCONN1_P=20(p)=20||=20= SERIALCONN1_P=20(p))=0A=20=20=20=20=20=20p->childp=20=3D=20Fplist_put=20= (p->childp,=20QCfilter,=20filter);=0A=20=20=20=20= setup_process_coding_systems=20(process);=0A=20=20=20=20return=20filter;=0A= ***************=20It=20gets=20two=20arguments:=20the=20process,=20and=20=0A= ***=201059,1065=20****=0A=20=20=20=20p=20=3D=20XPROCESS=20(process);=0A=20= =20=0A=20=20=20=20p->sentinel=20=3D=20sentinel;=0A!=20=20=20if=20= (NETCONN1_P=20(p))=0A=20=20=20=20=20=20p->childp=20=3D=20Fplist_put=20= (p->childp,=20QCsentinel,=20sentinel);=0A=20=20=20=20return=20sentinel;=0A= =20=20}=0A---=201066,1072=20----=0A=20=20=20=20p=20=3D=20XPROCESS=20= (process);=0A=20=20=0A=20=20=20=20p->sentinel=20=3D=20sentinel;=0A!=20=20= =20if=20(NETCONN1_P=20(p)=20||=20SERIALCONN1_P=20(p))=0A=20=20=20=20=20=20= p->childp=20=3D=20Fplist_put=20(p->childp,=20QCsentinel,=20sentinel);=0A=20= =20=20=20return=20sentinel;=0A=20=20}=0A***************=20Lisp_Object=20= Fprocess_datagram_address=20()=0A***=201164,1174=20****=0A=20=20DEFUN=20= ("process-contact",=20Fprocess_contact,=20Sprocess_contact,=0A=20=20=20=20= =20=20=20=20=201,=202,=200,=0A=20=20=20=20=20=20=20=20=20doc:=20/*=20= Return=20the=20contact=20info=20of=20PROCESS;=20t=20for=20a=20real=20= child.=0A!=20For=20a=20net=20connection,=20the=20value=20depends=20on=20= the=20optional=20KEY=20arg.=0A!=20If=20KEY=20is=20nil,=20value=20is=20a=20= cons=20cell=20of=20the=20form=20(HOST=20SERVICE),=0A!=20if=20KEY=20is=20= t,=20the=20complete=20contact=20information=20for=20the=20connection=20= is=0A!=20returned,=20else=20the=20specific=20value=20for=20the=20keyword=20= KEY=20is=20returned.=0A!=20See=20`make-network-process'=20for=20a=20list=20= of=20keywords.=20=20*/)=0A=20=20=20=20=20=20=20(process,=20key)=0A=20=20=20= =20=20=20=20register=20Lisp_Object=20process,=20key;=0A=20=20{=0A---=20= 1171,1183=20----=0A=20=20DEFUN=20("process-contact",=20Fprocess_contact,=20= Sprocess_contact,=0A=20=20=20=20=20=20=20=20=201,=202,=200,=0A=20=20=20=20= =20=20=20=20=20doc:=20/*=20Return=20the=20contact=20info=20of=20PROCESS;=20= t=20for=20a=20real=20child.=0A!=20For=20a=20network=20or=20serial=20= connection,=20the=20value=20depends=20on=20the=20optional=0A!=20KEY=20= arg.=20=20If=20KEY=20is=20nil,=20value=20is=20a=20cons=20cell=20of=20the=20= form=20(HOST=0A!=20SERVICE)=20for=20a=20network=20connection=20or=20= (PORT=20SPEED)=20for=20a=20serial=0A!=20connection.=20=20If=20KEY=20is=20= t,=20the=20complete=20contact=20information=20for=20the=0A!=20connection=20= is=20returned,=20else=20the=20specific=20value=20for=20the=20keyword=20= KEY=20is=0A!=20returned.=20=20See=20`make-network-process'=20or=20= `make-serial-process'=20for=20a=0A!=20list=20of=20keywords.=20=20*/)=0A=20= =20=20=20=20=20=20(process,=20key)=0A=20=20=20=20=20=20=20register=20= Lisp_Object=20process,=20key;=0A=20=20{=0A***************=20See=20= `make-network-process'=20for=20a=20list=20of=0A***=201184,1194=20****=0A=20= =20=09=09=09=20=20Fprocess_datagram_address=20(process));=0A=20=20#endif=0A= =20=20=0A!=20=20=20if=20(!NETCONN_P=20(process)=20||=20EQ=20(key,=20Qt))=0A= =20=20=20=20=20=20return=20contact;=0A!=20=20=20if=20(NILP=20(key))=0A=20= =20=20=20=20=20return=20Fcons=20(Fplist_get=20(contact,=20QChost),=0A=20=20= =09=09=20=20Fcons=20(Fplist_get=20(contact,=20QCservice),=20Qnil));=0A=20= =20=20=20return=20Fplist_get=20(contact,=20key);=0A=20=20}=0A=20=20=0A= ---=201193,1206=20----=0A=20=20=09=09=09=20=20Fprocess_datagram_address=20= (process));=0A=20=20#endif=0A=20=20=0A!=20=20=20if=20((!NETCONN_P=20= (process)=20&&=20!SERIALCONN_P=20(process))=20||=20EQ=20(key,=20Qt))=0A=20= =20=20=20=20=20return=20contact;=0A!=20=20=20if=20(NILP=20(key)=20&&=20= NETCONN_P=20(process))=0A=20=20=20=20=20=20return=20Fcons=20(Fplist_get=20= (contact,=20QChost),=0A=20=20=09=09=20=20Fcons=20(Fplist_get=20(contact,=20= QCservice),=20Qnil));=0A+=20=20=20if=20(NILP=20(key)=20&&=20SERIALCONN_P=20= (process))=0A+=20=20=20=20=20return=20Fcons=20(Fplist_get=20(contact,=20= QCport),=0A+=20=09=09=20=20Fcons=20(Fplist_get=20(contact,=20QCspeed),=20= Qnil));=0A=20=20=20=20return=20Fplist_get=20(contact,=20key);=0A=20=20}=0A= =20=20=0A***************=20DEFUN=20("set-process-plist",=20Fset_process=0A= ***=201215,1232=20****=0A=20=20=20=20return=20plist;=0A=20=20}=0A=20=20=0A= !=20#if=200=20/*=20Turned=20off=20because=20we=20don't=20currently=20= record=20this=20info=0A!=20=09=20in=20the=20process.=20=20Perhaps=20add=20= it.=20=20*/=0A!=20DEFUN=20("process-connection",=20Fprocess_connection,=20= Sprocess_connection,=201,=201,=200,=0A=20=20=20=20=20=20=20=20=20doc:=20= /*=20Return=20the=20connection=20type=20of=20PROCESS.=0A!=20The=20value=20= is=20nil=20for=20a=20pipe,=20t=20or=20`pty'=20for=20a=20pty,=20or=20= `stream'=20for=0A!=20a=20socket=20connection.=20=20*/)=0A=20=20=20=20=20=20= =20(process)=0A=20=20=20=20=20=20=20Lisp_Object=20process;=0A=20=20{=0A!=20= =20=20return=20XPROCESS=20(process)->type;=0A=20=20}=0A-=20#endif=0A=20=20= =0A=20=20#ifdef=20HAVE_SOCKETS=0A=20=20DEFUN=20= ("format-network-address",=20Fformat_network_address,=20= Sformat_network_address,=0A---=201227,1244=20----=0A=20=20=20=20return=20= plist;=0A=20=20}=0A=20=20=0A!=20DEFUN=20("process-type",=20= Fprocess_type,=20Sprocess_type,=201,=201,=200,=0A=20=20=20=20=20=20=20=20= =20doc:=20/*=20Return=20the=20connection=20type=20of=20PROCESS.=0A!=20= The=20value=20is=20either=20the=20symbol=20`real',=20`network',=20or=20= `serial'.=0A!=20PROCESS=20may=20be=20a=20process,=20a=20buffer,=20the=20= name=20of=20a=20process=20or=20buffer,=20or=0A!=20nil,=20indicating=20= the=20current=20buffer's=20process.=20=20*/)=0A=20=20=20=20=20=20=20= (process)=0A=20=20=20=20=20=20=20Lisp_Object=20process;=0A=20=20{=0A!=20=20= =20Lisp_Object=20proc;=0A!=20=20=20proc=20=3D=20get_process=20(process);=0A= !=20=20=20return=20XPROCESS=20(proc)->type;=0A=20=20}=0A=20=20=0A=20=20= #ifdef=20HAVE_SOCKETS=0A=20=20DEFUN=20("format-network-address",=20= Fformat_network_address,=20Sformat_network_address,=0A***************=20= list_processes_1=20(query_only)=0A***=201327,1333=20****=0A=20=20=0A=20=20= =20=20=20=20=20=20proc=20=3D=20Fcdr=20(XCAR=20(tail));=0A=20=20=20=20=20=20= =20=20p=20=3D=20XPROCESS=20(proc);=0A!=20=20=20=20=20=20=20if=20(NILP=20= (p->childp))=0A=20=20=09continue;=0A=20=20=20=20=20=20=20=20if=20(!NILP=20= (query_only)=20&&=20p->kill_without_query)=0A=20=20=09continue;=0A---=20= 1339,1345=20----=0A=20=20=0A=20=20=20=20=20=20=20=20proc=20=3D=20Fcdr=20= (XCAR=20(tail));=0A=20=20=20=20=20=20=20=20p=20=3D=20XPROCESS=20(proc);=0A= !=20=20=20=20=20=20=20if=20(NILP=20(p->type))=0A=20=20=09continue;=0A=20=20= =20=20=20=20=20=20if=20(!NILP=20(query_only)=20&&=20= p->kill_without_query)=0A=20=20=09continue;=0A***************=20= list_processes_1=20(query_only)=0A***=201395,1401=20****=0A=20=20=0A=20=20= =20=20=20=20=20=20proc=20=3D=20Fcdr=20(XCAR=20(tail));=0A=20=20=20=20=20=20= =20=20p=20=3D=20XPROCESS=20(proc);=0A!=20=20=20=20=20=20=20if=20(NILP=20= (p->childp))=0A=20=20=09continue;=0A=20=20=20=20=20=20=20=20if=20(!NILP=20= (query_only)=20&&=20p->kill_without_query)=0A=20=20=09continue;=0A---=20= 1407,1413=20----=0A=20=20=0A=20=20=20=20=20=20=20=20proc=20=3D=20Fcdr=20= (XCAR=20(tail));=0A=20=20=20=20=20=20=20=20p=20=3D=20XPROCESS=20(proc);=0A= !=20=20=20=20=20=20=20if=20(NILP=20(p->type))=0A=20=20=09continue;=0A=20=20= =20=20=20=20=20=20if=20(!NILP=20(query_only)=20&&=20= p->kill_without_query)=0A=20=20=09continue;=0A***************=20= list_processes_1=20(query_only)=0A***=201420,1426=20****=0A=20=20#endif=0A= =20=20=09=20=20=20=20Fprinc=20(symbol,=20Qnil);=0A=20=20=09}=0A!=20=20=20= =20=20=20=20else=20if=20(NETCONN1_P=20(p))=0A=20=20=09{=0A=20=20=09=20=20= if=20(EQ=20(symbol,=20Qexit))=0A=20=20=09=20=20=20=20write_string=20= ("closed",=20-1);=0A---=201432,1438=20----=0A=20=20#endif=0A=20=20=09=20=20= =20=20Fprinc=20(symbol,=20Qnil);=0A=20=20=09}=0A!=20=20=20=20=20=20=20= else=20if=20(NETCONN1_P=20(p)=20||=20SERIALCONN1_P=20(p))=0A=20=20=09{=0A= =20=20=09=20=20if=20(EQ=20(symbol,=20Qexit))=0A=20=20=09=20=20=20=20= write_string=20("closed",=20-1);=0A***************=20list_processes_1=20= (query_only)=0A***=201431,1436=20****=0A---=201443,1452=20----=0A=20=20=09= =20=20else=0A=20=20=09=20=20=20=20Fprinc=20(symbol,=20Qnil);=0A=20=20=09= }=0A+=20=20=20=20=20=20=20else=20if=20(SERIALCONN1_P=20(p))=0A+=20=09{=0A= +=20=09=20=20write_string=20("running",=20-1);=0A+=20=09}=0A=20=20=20=20=20= =20=20=20else=0A=20=20=09Fprinc=20(symbol,=20Qnil);=0A=20=20=0A= ***************=20list_processes_1=20(query_only)=0A***=201495,1500=20= ****=0A---=201511,1530=20----=0A=20=20=09=09=20=20=20(STRINGP=20(host)=20= ?=20(char=20*)SDATA=20(host)=20:=20"?"));=0A=20=20=09=20=20insert_string=20= (tembuf);=0A=20=20=20=20=20=20=20=20=20=20}=0A+=20=20=20=20=20=20=20else=20= if=20(SERIALCONN1_P=20(p))=0A+=20=09{=0A+=20=09=20=20Lisp_Object=20port=20= =3D=20Fplist_get=20(p->childp,=20QCport);=0A+=20=09=20=20Lisp_Object=20= speed=20=3D=20Fplist_get=20(p->childp,=20QCspeed);=0A+=20=09=20=20= sprintf=20(tembuf,=20"(serial=20port=20%s",=0A+=20=09=09=20=20=20STRINGP=20= (port)=20?=20(char=20*)=20SDATA=20(port)=20:=20"?");=0A+=20=09=20=20= insert_string=20(tembuf);=0A+=20=09=20=20if=20(INTEGERP=20(speed))=0A+=20= =09=20=20=20=20{=0A+=20=09=20=20=20=20=20=20sprintf=20(tembuf,=20"=20at=20= %d=20b/s",=20XINT=20(speed));=0A+=20=09=20=20=20=20=20=20insert_string=20= (tembuf);=0A+=20=09=20=20=20=20}=0A+=20=09=20=20insert_string=20(")\n");=0A= +=20=09}=0A=20=20=20=20=20=20=20=20else=0A=20=20=09{=0A=20=20=09=20=20= tem=20=3D=20p->command;=0A***************=20usage:=20(start-process=20= NAME=20BUFFER=20PROGRA=0A***=201621,1626=20****=0A---=201651,1657=20----=0A= =20=20=0A=20=20=20=20XPROCESS=20(proc)->childp=20=3D=20Qt;=0A=20=20=20=20= XPROCESS=20(proc)->plist=20=3D=20Qnil;=0A+=20=20=20XPROCESS=20= (proc)->type=20=3D=20Qreal;=0A=20=20=20=20XPROCESS=20(proc)->buffer=20=3D=20= buffer;=0A=20=20=20=20XPROCESS=20(proc)->sentinel=20=3D=20Qnil;=0A=20=20=20= =20XPROCESS=20(proc)->filter=20=3D=20Qnil;=0A***************=20= unwind_request_sigio=20(dummy)=0A***=202658,2668=20****=0A=20=20}=0A=20=20= #endif=0A=20=20=0A=20=20/*=20Create=20a=20network=20stream/datagram=20= client/server=20process.=20=20Treated=0A=20=20=20=20=20exactly=20like=20= a=20normal=20process=20when=20reading=20and=20writing.=20=20Primary=0A=20= =20=20=20=20differences=20are=20in=20status=20display=20and=20process=20= deletion.=20=20A=20network=0A=20=20=20=20=20connection=20has=20no=20PID;=20= you=20cannot=20signal=20it.=20=20All=20you=20can=20do=20is=0A!=20=20=20=20= stop/continue=20it=20and=20deactivate/close=20it=20via=20delete-process=20= */=0A=20=20=0A=20=20DEFUN=20("make-network-process",=20= Fmake_network_process,=20Smake_network_process,=0A=20=20=20=20=20=20=20=20= =200,=20MANY,=200,=0A---=202689,3352=20----=0A=20=20}=0A=20=20#endif=0A=20= =20=0A+=20DEFUN=20("serial-process-configure",=0A+=20=20=20=20=20=20=20=20= Fserial_process_configure,=0A+=20=20=20=20=20=20=20=20= Sserial_process_configure,=0A+=20=20=20=20=20=20=20=200,=20MANY,=200,=0A= +=20=20=20=20=20=20=20=20doc:=20/*=20Configure=20speed,=20bytesize,=20= etc.=20of=20a=20serial=20process.=0A+=20=0A+=20Arguments=20are=20= specified=20as=20keyword/argument=20pairs.=20=20Attributes=20that=0A+=20= are=20not=20given=20are=20re-initialized=20from=20the=20process's=20= current=0A+=20configuration=20(available=20via=20the=20function=20= `process-contact')=20or=20set=20to=0A+=20reasonable=20default=20values.=20= =20The=20following=20arguments=20are=20defined:=0A+=20=0A+=20:process=20= PROCESS,=20:name=20NAME,=20:buffer=20BUFFER,=20:port=20PORT=20--=20Any=20= of=0A+=20these=20arguments=20can=20be=20given=20to=20identify=20the=20= process=20that=20is=20to=20be=0A+=20configured.=20=20If=20none=20of=20= these=20arguments=20is=20given,=20the=20current=20buffer's=0A+=20process=20= is=20used.=0A+=20=0A+=20:speed=20SPEED=20--=20SPEED=20is=20the=20speed=20= of=20the=20serial=20port=20in=20bits=20per=0A+=20second,=20also=20called=20= baud=20rate.=20=20Any=20value=20can=20be=20given=20for=20SPEED,=20but=0A= +=20most=20serial=20ports=20work=20only=20at=20a=20few=20defined=20= values=20between=201200=20and=0A+=20115200,=20with=209600=20being=20the=20= most=20common=20value.=20=20If=20SPEED=20is=20nil,=20the=0A+=20serial=20= port=20is=20not=20configured=20any=20further,=20i.e.=20all=20other=20= arguments=0A+=20are=20ignored.=20=20This=20may=20be=20useful=20for=20= special=20serial=20ports=20such=20as=0A+=20Bluetooth-to-serial=20= converters=20which=20can=20only=20be=20configured=20through=20AT=0A+=20= commands.=20=20A=20value=20of=20nil=20for=20SPEED=20can=20be=20used=20= only=20when=20passed=0A+=20through=20`make-serial-process'=20or=20= `serial-term'.=0A+=20=0A+=20:bytesize=20BYTESIZE=20--=20BYTESIZE=20is=20= the=20number=20of=20bits=20per=20byte,=20which=0A+=20can=20be=207=20or=20= 8.=20=20If=20BYTESIZE=20is=20not=20given=20or=20nil,=20a=20value=20of=20= 8=20is=20used.=0A+=20=0A+=20:parity=20PARITY=20--=20PARITY=20can=20be=20= nil=20(don't=20use=20parity),=20the=20symbol=0A+=20`odd'=20(use=20odd=20= parity),=20or=20the=20symbol=20`even'=20(use=20even=20parity).=20=20If=0A= +=20PARITY=20is=20not=20given,=20no=20parity=20is=20used.=0A+=20=0A+=20= :stopbits=20STOPBITS=20--=20STOPBITS=20is=20the=20number=20of=20stop=20= bits=20used=20to=0A+=20terminate=20a=20byte=20transmission.=20=20= STOPBITS=20can=20be=201=20or=202.=20=20If=20STOPBITS=0A+=20is=20not=20= given=20or=20nil,=201=20stop=20bit=20is=20used.=0A+=20=0A+=20= :flowcontrol=20FLOWCONTROL=20--=20FLOWCONTROL=20determines=20the=20type=20= of=0A+=20flowcontrol=20to=20be=20used,=20which=20is=20either=20nil=20= (don't=20use=20flowcontrol),=0A+=20the=20symbol=20`hw'=20(use=20RTS/CTS=20= hardware=20flowcontrol),=20or=20the=20symbol=20`sw'=0A+=20\(use=20= XON/XOFF=20software=20flowcontrol).=20=20If=20FLOWCONTROL=20is=20not=20= given,=20no=0A+=20flowcontrol=20is=20used.=0A+=20=0A+=20= `serial-process-configure'=20is=20called=20by=20`make-serial-process'=20= for=20the=0A+=20initial=20configuration=20of=20the=20serial=20port.=0A+=20= =0A+=20Examples:=0A+=20=0A+=20\(serial-process-configure=20:process=20= "/dev/ttyS0"=20:speed=201200)=0A+=20=0A+=20\(serial-process-configure=0A= +=20=20=20=20=20:buffer=20"COM1"=20:stopbits=201=20:parity=20'odd=20= :flowcontrol=20'hw)=0A+=20=0A+=20\(serial-process-configure=20:port=20= "\\\\.\\COM13"=20:bytesize=207)=0A+=20=0A+=20usage:=20= (serial-process-configure=20&rest=20ARGS)=20=20*/)=0A+=20=20=20=20=20=20= (nargs,=20args)=0A+=20=20=20=20=20=20int=20nargs;=0A+=20=20=20=20=20=20= Lisp_Object=20*args;=0A+=20{=0A+=20#ifdef=20WINDOWSNT=0A+=20#define=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20#else=20/*=20not=20WINDOWSNT=20=20= */=0A+=20#ifdef=20HAVE_TERMIOS=0A+=20#define=20= SERIAL_PROCESS_CONFIGURE_HAVE_TERMIOS=0A+=20#endif=20/*=20HAVE_TERMIOS=20= =20*/=0A+=20#endif=20/*=20WINDOWSNT=20=20*/=0A+=20=0A+=20=20=20struct=20= Lisp_Process=20*p;=0A+=20=20=20Lisp_Object=20contact=20=3D=20Qnil,=20= proc=20=3D=20Qnil,=20speed=20=3D=20Qnil,=20tem=20=3D=20Qnil;=0A+=20=20=20= Lisp_Object=20childp2=20=3D=20Qnil;=0A+=20=20=20struct=20gcpro=20gcpro1;=0A= +=20=20=20int=20err=20=3D=20-1;=0A+=20=20=20char=20summary[4]=20=3D=20= {0,=200,=200,=200};=20/*=20This=20usually=20becomes=20"8N1".=20=20*/=0A+=20= #ifdef=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20=20=20HANDLE=20hnd;=0A= +=20=20=20DCB=20dcb;=0A+=20=20=20COMMTIMEOUTS=20ct;=0A+=20#else=0A+=20=20= =20struct=20termios=20attr;=0A+=20#endif=0A+=20=0A+=20#ifndef=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20#ifndef=20= SERIAL_PROCESS_CONFIGURE_HAVE_TERMIOS=0A+=20=20=20error=20("Cannot=20= configure=20serial=20port");=0A+=20#endif=0A+=20#endif=0A+=20=0A+=20=20=20= contact=20=3D=20Flist=20(nargs,=20args);=0A+=20=20=20GCPRO1=20(contact);=0A= +=20=0A+=20=20=20proc=20=3D=20Fplist_get=20(contact,=20QCprocess);=0A+=20= =20=20if=20(NILP=20(proc))=0A+=20=20=20=20=20proc=20=3D=20Fplist_get=20= (contact,=20QCname);=0A+=20=20=20if=20(NILP=20(proc))=0A+=20=20=20=20=20= proc=20=3D=20Fplist_get=20(contact,=20QCbuffer);=0A+=20=20=20if=20(NILP=20= (proc))=0A+=20=20=20=20=20proc=20=3D=20Fplist_get=20(contact,=20QCport);=0A= +=20=20=20proc=20=3D=20get_process=20(proc);=0A+=20=20=20p=20=3D=20= XPROCESS=20(proc);=0A+=20=20=20if=20(p->type=20!=3D=20Qserial)=0A+=20=20=20= =20=20error=20("Not=20a=20serial=20process");=0A+=20=0A+=20#ifdef=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20=20=20if=20((fd_info[=20p->infd=20= ].flags=20&=20FILE_SERIAL)=20=3D=3D=200)=0A+=20=20=20=20=20error=20("Not=20= a=20serial=20process");=0A+=20=20=20hnd=20=3D=20fd_info[=20p->infd=20= ].hnd;=0A+=20#endif=0A+=20=0A+=20=20=20if=20(NILP=20(Fplist_get=20= (p->childp,=20QCspeed)))=0A+=20=20=20=20=20{=0A+=20=20=20=20=20=20=20= UNGCPRO;=0A+=20=20=20=20=20=20=20return=20Qnil;=0A+=20=20=20=20=20}=0A+=20= =20=20childp2=20=3D=20Fcopy_sequence=20(p->childp);=0A+=20=0A+=20=20=20= /*=20Read=20port=20attributes=20and=20prepare=20default=20configuration.=20= =20*/=0A+=20#ifdef=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20=20=20/*=20= Initialise=20timeouts=20for=20blocking=20read=20and=20blocking=20write.=20= =20*/=0A+=20=20=20if=20(!GetCommTimeouts=20(hnd,=20&ct))=0A+=20=20=20=20=20= error=20("GetCommTimeouts()=20failed");=0A+=20=20=20= ct.ReadIntervalTimeout=09=20=3D=200;=0A+=20=20=20= ct.ReadTotalTimeoutMultiplier=09=20=3D=200;=0A+=20=20=20= ct.ReadTotalTimeoutConstant=09=20=3D=200;=0A+=20=20=20= ct.WriteTotalTimeoutMultiplier=20=3D=200;=0A+=20=20=20= ct.WriteTotalTimeoutConstant=09=20=3D=200;=0A+=20=20=20if=20= (!SetCommTimeouts=20(hnd,=20&ct))=0A+=20=20=20=20=20error=20= ("SetCommTimeouts()=20failed");=0A+=20=0A+=20=20=20memset=20(&dcb,=200,=20= sizeof=20(dcb));=0A+=20=20=20dcb.DCBlength=20=3D=20sizeof=20(DCB);=0A+=20= =20=20if=20(!GetCommState=20(hnd,=20&dcb))=0A+=20=20=20=20=20error=20= ("GetCommState()=20failed");=0A+=20=20=20dcb.fBinary=09=09=3D=20TRUE;=0A= +=20=20=20dcb.fNull=09=09=3D=20FALSE;=0A+=20=20=20dcb.fAbortOnError=09=3D=20= FALSE;=0A+=20=20=20/*=20dcb.XonLim=20and=20dcb.XoffLim=20are=20set=20by=20= GetCommState()=20*/=0A+=20=20=20dcb.ErrorChar=09=09=3D=200;=0A+=20=20=20= dcb.EofChar=09=09=3D=200;=0A+=20=20=20dcb.EvtChar=20=20=20=20=20=20=20=20= =20=20=20=3D=200;=0A+=20#else=20/*=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20= =20*/=0A+=20=20=20err=20=3D=20tcgetattr=20(p->outfd,=20&attr);=0A+=20=20=20= if=20(err=20!=3D=200)=0A+=20=20=20=20=20error=20("tcgetattr()=20failed:=20= %s",=20emacs_strerror=20(errno));=0A+=20=20=20cfmakeraw=20(&attr);=0A+=20= #if=20defined=20(CLOCAL)=0A+=20=20=20attr.c_cflag=20|=3D=20CLOCAL;=0A+=20= #endif=0A+=20#if=20defined=20(CREAD)=0A+=20=20=20attr.c_cflag=20|=20= CREAD;=0A+=20#endif=0A+=20#endif=20/*=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20=0A+=20=20=20/*=20= Configure=20speed.=20=20*/=0A+=20=20=20if=20(!NILP=20(Fplist_member=20= (contact,=20QCspeed)))=0A+=20=20=20=20=20speed=20=3D=20Fplist_get=20= (contact,=20QCspeed);=0A+=20=20=20else=0A+=20=20=20=20=20speed=20=3D=20= Fplist_get=20(p->childp,=20QCspeed);=0A+=20=20=20CHECK_NUMBER=20(speed);=0A= +=20#ifdef=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20=20=20dcb.BaudRate=20= =3D=20XINT=20(speed);=0A+=20#else=20/*=20not=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20=20=20err=20=3D=20= cfsetspeed=20(&attr,=20XINT=20(speed));=0A+=20=20=20if=20(err=20!=3D=20= 0)=0A+=20=20=20=20=20error=20("cfsetspeed(%d)=20failed:=20%s",=20XINT=20= (speed),=20emacs_strerror=20(errno));=0A+=20#endif=20/*=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20=20=20childp2=20=3D=20= Fplist_put=20(childp2,=20QCspeed,=20speed);=0A+=20=0A+=20=20=20/*=20= Configure=20bytesize.=20=20*/=0A+=20=20=20if=20(!NILP=20(Fplist_member=20= (contact,=20QCbytesize)))=0A+=20=20=20=20=20tem=20=3D=20Fplist_get=20= (contact,=20QCbytesize);=0A+=20=20=20else=0A+=20=20=20=20=20tem=20=3D=20= Fplist_get=20(p->childp,=20QCbytesize);=0A+=20=20=20if=20(NILP=20(tem))=0A= +=20=20=20=20=20tem=20=3D=20make_number=20(8);=0A+=20=20=20CHECK_NUMBER=20= (tem);=0A+=20=20=20if=20(XINT=20(tem)=20!=3D=207=20&&=20XINT=20(tem)=20= !=3D=208)=0A+=20=20=20=20=20error=20(":bytesize=20must=20be=20nil=20(8),=20= 7,=20or=208");=0A+=20#ifdef=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20=20= =20dcb.ByteSize=20=3D=20XINT=20(tem);=0A+=20=20=20summary[0]=20=3D=20= XINT=20(tem)=20+=20'0';=0A+=20#else=20/*=20not=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20#if=20defined=20(CSIZE)=0A= +=20=20=20attr.c_cflag=20&=3D=20~CSIZE;=0A+=20#else=0A+=20=20=20error=20= ("Bytesize=20cannot=20be=20changed");=0A+=20#endif=0A+=20=20=20if=20= (XINT=20(tem)=20=3D=3D=207)=0A+=20=20=20=20=20{=0A+=20#if=20defined=20= (CS7)=0A+=20=20=20=20=20=20=20attr.c_cflag=20|=3D=20CS7;=0A+=20=20=20=20=20= =20=20summary[0]=20=3D=20'7';=0A+=20#else=0A+=20=20=20=20=20=20=20= error("Bytesize=207=20not=20supported");=0A+=20#endif=0A+=20=20=20=20=20= }=0A+=20=20=20if=20(XINT=20(tem)=20=3D=3D=208)=0A+=20=20=20=20=20{=0A+=20= #if=20defined=20(CS8)=0A+=20=20=20=20=20=20=20attr.c_cflag=20|=3D=20CS8;=0A= +=20=20=20=20=20=20=20summary[0]=20=3D=20'8';=0A+=20#else=0A+=20=20=20=20= =20=20=20error("Bytesize=208=20not=20supported");=0A+=20#endif=0A+=20=20=20= =20=20}=0A+=20#endif=20/*=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A= +=20=20=20childp2=20=3D=20Fplist_put=20(childp2,=20QCbytesize,=20tem);=0A= +=20=0A+=20=20=20/*=20Configure=20parity.=20=20*/=0A+=20=20=20if=20= (!NILP=20(Fplist_member=20(contact,=20QCparity)))=0A+=20=20=20=20=20tem=20= =3D=20Fplist_get=20(contact,=20QCparity);=0A+=20=20=20else=0A+=20=20=20=20= =20tem=20=3D=20Fplist_get=20(p->childp,=20QCparity);=0A+=20#ifdef=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20=20=20dcb.fParity=20=3D=20= FALSE;=0A+=20=20=20dcb.Parity=20=3D=20NOPARITY;=0A+=20=20=20= dcb.fErrorChar=20=3D=20FALSE;=0A+=20#else=20/*=20not=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20#if=20defined=20= (PARENB)=20&&=20defined=20(PARODD)=20&&=20defined=20(IGNPAR)=20&&=20= defined=20(INPCK)=0A+=20=20=20attr.c_cflag=20&=3D=20~(PARENB=20|=20= PARODD);=0A+=20=20=20attr.c_iflag=20&=3D=20~(IGNPAR=20|=20INPCK);=0A+=20= #endif=0A+=20#endif=20/*=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A= +=20=20=20if=20(NILP=20(tem))=0A+=20=20=20=20=20{=0A+=20=20=20=20=20=20=20= summary[1]=20=3D=20'N';=0A+=20=20=20=20=20}=0A+=20=20=20else=20if=20(EQ=20= (tem,=20Qeven))=0A+=20=20=20=20=20{=0A+=20=20=20=20=20=20=20summary[1]=20= =3D=20'E';=0A+=20#ifdef=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20=20=20= =20=20=20=20dcb.fParity=20=3D=20TRUE;=0A+=20=20=20=20=20=20=20dcb.Parity=20= =3D=20EVENPARITY;=0A+=20=20=20=20=20=20=20dcb.fErrorChar=20=3D=20TRUE;=0A= +=20#else=20/*=20not=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20= #if=20defined=20(PARENB)=20&&=20defined=20(IGNPAR)=20&&=20defined=20= (INPCK)=0A+=20=20=20=20=20=20=20attr.c_cflag=20|=3D=20PARENB;=0A+=20=20=20= =20=20=20=20attr.c_iflag=20|=3D=20IGNPAR=20|=20INPCK;=0A+=20#else=0A+=20=20= =20=20=20=20=20error=20("Even=20parity=20not=20available");=0A+=20#endif=0A= +=20#endif=20/*=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20=20=20= =20=20}=0A+=20=20=20else=20if=20(EQ=20(tem,=20Qodd))=0A+=20=20=20=20=20{=0A= +=20=20=20=20=20=20=20summary[1]=20=3D=20'O';=0A+=20#ifdef=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20=20=20=20=20=20=20dcb.fParity=20= =3D=20TRUE;=0A+=20=20=20=20=20=20=20dcb.Parity=20=3D=20ODDPARITY;=0A+=20=20= =20=20=20=20=20dcb.fErrorChar=20=3D=20TRUE;=0A+=20#else=20/*=20not=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20#if=20defined=20= (PARENB)=20&&=20defined=20(PARODD)=20&&=20defined=20(IGNPAR)=20&&=20= defined=20(INPCK)=0A+=20=20=20=20=20=20=20attr.c_cflag=20|=3D=20PARENB=20= |=20PARODD;=0A+=20=20=20=20=20=20=20attr.c_iflag=20|=3D=20IGNPAR=20|=20= INPCK;=0A+=20#else=0A+=20=20=20=20=20=20=20error=20("Odd=20parity=20not=20= available");=0A+=20#endif=0A+=20#endif=20/*=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20=20=20=20=20}=0A+=20=20=20= else=0A+=20=20=20=20=20{=0A+=20=20=20=20=20=20=20error=20(":parity=20= must=20be=20nil=20(no=20parity),=20`even',=20or=20`odd'");=0A+=20=20=20=20= =20}=0A+=20=20=20childp2=20=3D=20Fplist_put=20(childp2,=20QCparity,=20= tem);=0A+=20=0A+=20=20=20/*=20Configure=20stop=20bits.=20=20*/=0A+=20=20=20= if=20(!NILP=20(Fplist_member=20(contact,=20QCstopbits)))=0A+=20=20=20=20=20= tem=20=3D=20Fplist_get=20(contact,=20QCstopbits);=0A+=20=20=20else=0A+=20= =20=20=20=20tem=20=3D=20Fplist_get=20(p->childp,=20QCstopbits);=0A+=20=20= =20if=20(NILP=20(tem))=0A+=20=20=20=20=20tem=20=3D=20make_number=20(1);=0A= +=20=20=20CHECK_NUMBER=20(tem);=0A+=20#ifdef=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20=20=20dcb.StopBits=20=3D=20= ONESTOPBIT;=0A+=20#else=20/*=20not=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20= =20*/=0A+=20#if=20defined=20(CSTOPB)=0A+=20=20=20attr.c_cflag=20&=3D=20= ~CSTOPB;=0A+=20#endif=0A+=20#endif=20/*=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20=20=20if=20(XINT=20= (tem)=20=3D=3D=201)=0A+=20=20=20=20=20{=0A+=20=20=20=20=20=20=20= summary[2]=20=3D=20'1';=0A+=20=20=20=20=20}=0A+=20=20=20else=20if=20= (XINT=20(tem)=20=3D=3D=202)=0A+=20=20=20=20=20{=0A+=20=20=20=20=20=20=20= summary[2]=20=3D=20'2';=0A+=20#ifdef=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20=20=20=20=20=20=20dcb.StopBits=20= =3D=20TWOSTOPBITS;=0A+=20#else=20/*=20not=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20#if=20defined=20= (CSTOPB)=0A+=20=20=20=20=20=20=20attr.c_cflag=20|=3D=20CSTOPB;=0A+=20= #else=0A+=20=20=20=20=20=20=20error=20("2=20stop=20bits=20not=20= supported");=0A+=20#endif=0A+=20#endif=20/*=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20=20=20=20=20}=0A+=20=20=20= else=0A+=20=20=20=20=20{=0A+=20=20=20=20=20=20=20error=20(":stopbits=20= must=20be=20nil=20(1=20stop=20bit),=201,=20or=202");=0A+=20=20=20=20=20}=0A= +=20=20=20childp2=20=3D=20Fplist_put=20(childp2,=20QCstopbits,=20tem);=0A= +=20=0A+=20=20=20/*=20Configure=20flow=20control.=20=20*/=0A+=20=20=20if=20= (!NILP=20(Fplist_member=20(contact,=20QCflowcontrol)))=0A+=20=20=20=20=20= tem=20=3D=20Fplist_get=20(contact,=20QCflowcontrol);=0A+=20=20=20else=0A= +=20=20=20=20=20tem=20=3D=20Fplist_get=20(p->childp,=20QCflowcontrol);=0A= +=20#ifdef=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20=20=20= dcb.fOutxCtsFlow=09=3D=20FALSE;=0A+=20=20=20dcb.fOutxDsrFlow=09=3D=20= FALSE;=0A+=20=20=20dcb.fDtrControl=09=3D=20DTR_CONTROL_DISABLE;=0A+=20=20= =20dcb.fDsrSensitivity=09=3D=20FALSE;=0A+=20=20=20dcb.fTXContinueOnXoff=09= =3D=20FALSE;=0A+=20=20=20dcb.fOutX=09=09=3D=20FALSE;=0A+=20=20=20= dcb.fInX=09=09=3D=20FALSE;=0A+=20=20=20dcb.fRtsControl=09=3D=20= RTS_CONTROL_DISABLE;=0A+=20=20=20dcb.XonChar=09=09=3D=2017;=20/*=20= Control-Q=20=20*/=0A+=20=20=20dcb.XoffChar=09=09=3D=2019;=20/*=20= Control-S=20=20*/=0A+=20#else=20/*=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20= =20*/=0A+=20#if=20defined=20(CRTSCTS)=0A+=20=20=20attr.c_cflag=20&=3D=20= ~CRTSCTS;=0A+=20#endif=0A+=20#if=20defined=20(CNEW_RTSCTS)=0A+=20=20=20= attr.c_cflag=20&=3D=20~CNEW_RTSCTS;=0A+=20#endif=0A+=20#if=20defined=20= (IXON)=20&&=20defined=20(IXOFF)=0A+=20=20=20attr.c_iflag=20&=3D=20~(IXON=20= |=20IXOFF);=0A+=20#endif=0A+=20#endif=20/*=20= SERIAL_PROCESS_CONFIGURE_HAVE_TERMIOS=20=20*/=0A+=20=20=20if=20(NILP=20= (tem))=0A+=20=20=20=20=20{=0A+=20=20=20=20=20=20=20/*=20Already=20= configured.=20=20*/=0A+=20=20=20=20=20}=0A+=20=20=20else=20if=20(EQ=20= (tem,=20Qhw))=0A+=20=20=20=20=20{=0A+=20#ifdef=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20=20=20=20=20=20=20= dcb.fRtsControl=20=3D=20RTS_CONTROL_HANDSHAKE;=0A+=20=20=20=20=20=20=20= dcb.fOutxCtsFlow=20=3D=20TRUE;=0A+=20#else=20/*=20not=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20#if=20defined=20= (CRTSCTS)=0A+=20=20=20=20=20=20=20attr.c_cflag=20|=3D=20CRTSCTS;=0A+=20= #elif=20defined=20(CNEW_RTSCTS)=0A+=20=20=20=20=20=20=20attr.c_cflag=20= |=3D=20CNEW_RTSCTS;=0A+=20#else=0A+=20=20=20=20=20=20=20error=20= ("Hardware=20flowcontrol=20(RTS/CTS)=20not=20supported");=0A+=20#endif=0A= +=20#endif=20/*=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20=20=20= =20=20}=0A+=20=20=20else=20if=20(EQ=20(tem,=20Qsw))=0A+=20=20=20=20=20{=0A= +=20#ifdef=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20=20=20=20=20=20=20= dcb.fOutX=20=3D=20TRUE;=0A+=20=20=20=20=20=20=20dcb.fInX=20=3D=20TRUE;=0A= +=20#else=20/*=20not=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20= #if=20defined=20(IXON)=20&&=20defined=20(IXOFF)=0A+=20=20=20=20=20=20=20= attr.c_iflag=20|=3D=20IXON=20|=20IXOFF;=0A+=20#else=0A+=20=20=20=20=20=20= =20error=20("Software=20flowcontrol=20(XON/XOFF)=20not=20supported");=0A= +=20#endif=0A+=20#endif=20/*=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20= */=0A+=20=20=20=20=20}=0A+=20=20=20else=0A+=20=20=20=20=20{=0A+=20=20=20=20= =20=20=20error=20(":flowcontrol=20must=20be=20nil=20(no=20flow=20= control),=20`hw',=20or=20`sw'");=0A+=20=20=20=20=20}=0A+=20=20=20childp2=20= =3D=20Fplist_put=20(childp2,=20QCflowcontrol,=20tem);=0A+=20=0A+=20=20=20= /*=20Activate=20configuration.=20=20*/=0A+=20#ifdef=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=0A+=20=20=20if=20(!SetCommState=20= (hnd,=20&dcb))=0A+=20=20=20=20=20error=20("SetCommState()=20failed");=0A= +=20#else=20/*=20not=20SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20=20= =20err=20=3D=20tcsetattr=20(p->outfd,=20TCSANOW,=20&attr);=0A+=20=20=20= if=20(err=20!=3D=200)=0A+=20=20=20=20=20error=20("tcsetattr()=20failed:=20= %s",=20emacs_strerror=20(errno));=0A+=20#endif=20/*=20= SERIAL_PROCESS_CONFIGURE_WINDOWSNT=20=20*/=0A+=20=0A+=20=20=20childp2=20= =3D=20Fplist_put=20(childp2,=20QCsummary,=20build_string=20(summary));=0A= +=20=20=20p->childp=20=3D=20childp2;=0A+=20=0A+=20=20=20UNGCPRO;=0A+=20=20= =20return=20Qnil;=0A+=20}=0A+=20=0A+=20/*=20Used=20by=20= make-serial-process=20to=20recover=20from=20errors.=20=20*/=0A+=20= Lisp_Object=20make_serial_process_unwind=20(Lisp_Object=20proc)=0A+=20{=0A= +=20=20=20if=20(!PROCESSP=20(proc))=0A+=20=20=20=20=20abort=20();=0A+=20=20= =20remove_process=20(proc);=0A+=20=20=20return=20Qnil;=0A+=20}=0A+=20=0A= +=20DEFUN=20("make-serial-process",=20Fmake_serial_process,=20= Smake_serial_process,=0A+=20=20=20=20=20=20=20=200,=20MANY,=200,=0A+=20=20= =20=20=20=20=20=20doc:=20/*=20Create=20and=20return=20a=20serial=20port=20= process.=0A+=20=0A+=20In=20Emacs,=20serial=20port=20connections=20are=20= represented=20by=20process=20objects,=0A+=20so=20input=20and=20output=20= work=20as=20for=20subprocesses,=20and=20`delete-process'=0A+=20closes=20= a=20serial=20port=20connection.=20=20However,=20a=20serial=20process=20= has=20no=0A+=20process=20id,=20it=20cannot=20be=20signaled,=20and=20the=20= status=20codes=20are=20different=0A+=20from=20normal=20processes.=0A+=20=0A= +=20`make-serial-process'=20creates=20a=20process=20and=20a=20buffer,=20= on=20which=20you=0A+=20probably=20want=20to=20use=20= `process-send-string'.=20=20Try=20\\[serial-term]=20for=0A+=20an=20= interactive=20terminal.=20=20See=20below=20for=20examples.=0A+=20=0A+=20= Arguments=20are=20specified=20as=20keyword/argument=20pairs.=20=20The=20= following=0A+=20arguments=20are=20defined:=0A+=20=0A+=20:port=20PORT=20= --=20(mandatory)=20PORT=20is=20the=20path=20or=20name=20of=20the=20= serial=20port.=0A+=20For=20example,=20this=20could=20be=20"/dev/ttyS0"=20= on=20Unix.=20=20On=20Windows,=20this=0A+=20could=20be=20"COM1",=20or=20= "\\\\.\\COM10"=20for=20ports=20higher=20than=20COM9=20(double=0A+=20the=20= backslashes=20in=20strings).=0A+=20=0A+=20:speed=20SPEED=20--=20= (mandatory)=20is=20handled=20by=20`serial-process-configure',=0A+=20= which=20is=20called=20by=20`make-serial-process'.=0A+=20=0A+=20:name=20= NAME=20--=20NAME=20is=20the=20name=20of=20the=20process.=20=20If=20NAME=20= is=20not=20given,=0A+=20the=20value=20of=20PORT=20is=20used.=0A+=20=0A+=20= :buffer=20BUFFER=20--=20BUFFER=20is=20the=20buffer=20(or=20buffer-name)=20= to=20associate=0A+=20with=20the=20process.=20=20Process=20output=20goes=20= at=20the=20end=20of=20that=20buffer,=0A+=20unless=20you=20specify=20an=20= output=20stream=20or=20filter=20function=20to=20handle=20the=0A+=20= output.=20=20If=20BUFFER=20is=20not=20given,=20the=20value=20of=20NAME=20= is=20used.=0A+=20=0A+=20:coding=20CODING=20--=20If=20CODING=20is=20a=20= symbol,=20it=20specifies=20the=20coding=0A+=20system=20used=20for=20both=20= reading=20and=20writing=20for=20this=20process.=20=20If=20CODING=0A+=20= is=20a=20cons=20(DECODING=20.=20ENCODING),=20DECODING=20is=20used=20for=20= reading,=20and=0A+=20ENCODING=20is=20used=20for=20writing.=0A+=20=0A+=20= :noquery=20BOOL=20--=20When=20exiting=20Emacs,=20query=20the=20user=20if=20= BOOL=20is=20nil=20and=0A+=20the=20process=20is=20running.=20=20If=20BOOL=20= is=20not=20given,=20query=20before=20exiting.=0A+=20=0A+=20:stop=20BOOL=20= --=20Start=20process=20in=20the=20`stopped'=20state=20if=20BOOL=20is=20= non-nil.=0A+=20In=20the=20stopped=20state,=20a=20serial=20process=20does=20= not=20accept=20incoming=20data,=0A+=20but=20you=20can=20send=20outgoing=20= data.=20=20The=20stopped=20state=20is=20cleared=20by=0A+=20= `continue-process'=20and=20set=20by=20`stop-process'.=0A+=20=0A+=20= :filter=20FILTER=20--=20Install=20FILTER=20as=20the=20process=20filter.=0A= +=20=0A+=20:sentinel=20SENTINEL=20--=20Install=20SENTINEL=20as=20the=20= process=20sentinel.=0A+=20=0A+=20:plist=20PLIST=20--=20Install=20PLIST=20= as=20the=20initial=20plist=20of=20the=20process.=0A+=20=0A+=20:speed,=20= :bytesize,=20:parity,=20:stopbits,=20:flowcontrol=20are=20handled=20by=0A= +=20`serial-process-configure',=20which=20is=20called=20by=20= `make-serial-process'.=0A+=20=0A+=20The=20original=20argument=20list,=20= possibly=20modified=20by=20later=20configuration,=0A+=20is=20available=20= via=20the=20function=20`process-contact'.=0A+=20=0A+=20Examples:=0A+=20=0A= +=20\(make-serial-process=20:port=20"/dev/ttyS0"=20:speed=209600)=0A+=20=0A= +=20\(make-serial-process=20:port=20"COM1"=20:speed=20115200=20:stopbits=20= 2)=0A+=20=0A+=20\(make-serial-process=20:port=20"\\\\.\\COM13"=20:speed=20= 1200=20:bytesize=207=20:parity=20'odd)=0A+=20=0A+=20= \(make-serial-process=20:port=20"/dev/tty.BlueConsole-SPP-1"=20:speed=20= nil)=0A+=20=0A+=20usage:=20=20(make-serial-process=20&rest=20ARGS)=20=20= */)=0A+=20=20=20=20=20=20(nargs,=20args)=0A+=20=20=20=20=20=20int=20= nargs;=0A+=20=20=20=20=20=20Lisp_Object=20*args;=0A+=20{=0A+=20#ifdef=20= WINDOWSNT=0A+=20=20=20HANDLE=20hnd;=0A+=20=20=20child_process=20*cp;=0A+=20= #endif=0A+=20=20=20int=20fd=20=3D=20-1;=0A+=20=20=20Lisp_Object=20proc,=20= contact,=20port;=0A+=20=20=20struct=20Lisp_Process=20*p;=0A+=20=20=20int=20= err=20=3D=20-1;=0A+=20=20=20struct=20gcpro=20gcpro1;=0A+=20=20=20= Lisp_Object=20name,=20buffer;=0A+=20=20=20Lisp_Object=20tem,=20val;=0A+=20= =20=20Lisp_Object=20coding;=0A+=20=20=20int=20specpdl_count=20=3D=20-1;=0A= +=20=0A+=20=20=20if=20(nargs=20=3D=3D=200)=0A+=20=20=20=20=20return=20= Qnil;=0A+=20=0A+=20=20=20contact=20=3D=20Flist=20(nargs,=20args);=0A+=20=20= =20GCPRO1=20(contact);=0A+=20=0A+=20#ifdef=20WINDOWSNT=0A+=20=20=20= init_winsock=20(TRUE);=0A+=20#endif=0A+=20=0A+=20=20=20/*=20Most=20= serial=20ports=20must=20be=20opened=20non-blocking=20(see=20man=0A+=20=20= =20=20=20=20termios(4)),=20so=20non-blocking=20operations=20must=20be=20= available.=20=20*/=0A+=20#if=20defined(TERM)=20||=20= (!defined(O_NONBLOCK)=20&&=20!defined(O_NDELAY))=0A+=20=20=20error=20= ("Serial=20connections=20are=20not=20supported");=0A+=20#endif=0A+=20=0A= +=20=20=20port=20=3D=20Fplist_get=20(contact,=20QCport);=0A+=20=20=20if=20= (NILP=20(port))=0A+=20=20=20=20=20error=20("No=20port=20specified");=0A+=20= =20=20CHECK_STRING=20(port);=0A+=20=0A+=20=20=20if=20(NILP=20= (Fplist_member=20(contact,=20QCspeed)))=0A+=20=20=20=20=20error=20= (":speed=20not=20specified");=0A+=20=20=20if=20(!NILP=20(Fplist_get=20= (contact,=20QCspeed)))=0A+=20=20=20=20=20CHECK_NUMBER=20(Fplist_get=20= (contact,=20QCspeed));=0A+=20=0A+=20=20=20name=20=3D=20Fplist_get=20= (contact,=20QCname);=0A+=20=20=20if=20(NILP=20(name))=0A+=20=20=20=20=20= name=20=3D=20port;=0A+=20=20=20CHECK_STRING=20(name);=0A+=20=20=20proc=20= =3D=20make_process=20(name);=0A+=20=20=20specpdl_count=20=3D=20= SPECPDL_INDEX=20();=0A+=20=20=20record_unwind_protect=20= (make_serial_process_unwind,=20proc);=0A+=20=20=20p=20=3D=20XPROCESS=20= (proc);=0A+=20=0A+=20#ifdef=20WINDOWSNT=0A+=20=20=20hnd=20=3D=20= CreateFile=20((char*)=20SDATA=20(port),=20GENERIC_READ=20|=20= GENERIC_WRITE,=200,=0A+=20=09=09=20=20=20=200,=20OPEN_EXISTING,=20= FILE_FLAG_OVERLAPPED,=200);=0A+=20=20=20if=20(hnd=20=3D=3D=20= INVALID_HANDLE_VALUE)=0A+=20=20=20=20=20error=20("Could=20not=20open=20= %s",=20(char*)=20SDATA=20(port));=0A+=20=20=20fd=20=3D=20(int)=20= _open_osfhandle=20((int)=20hnd,=200);=0A+=20=20=20if=20(fd=20=3D=3D=20= -1)=0A+=20=20=20=20=20error=20("Could=20not=20open=20%s",=20(char*)=20= SDATA=20(port));=0A+=20#else=20/*=20not=20WINDOWSNT=20=20*/=0A+=20=20=20= fd=20=3D=20emacs_open=20((char*)=20SDATA=20(port),=0A+=20=09=09=20=20=20= O_RDWR=0A+=20#ifdef=20O_NONBLOCK=0A+=20=09=09=20=20=20|=20O_NONBLOCK=0A+=20= #else=0A+=20=09=09=20=20=20|=20O_NDELAY=0A+=20#endif=0A+=20#ifdef=20= O_NOCTTY=0A+=20=09=09=20=20=20|=20O_NOCTTY=0A+=20#endif=0A+=20=09=09=20=20= =20,=200);=0A+=20=20=20if=20(fd=20<=200)=0A+=20=20=20=20=20{=0A+=20=20=20= =20=20=20=20error=20("Could=20not=20open=20%s:=20%s",=0A+=20=09=20=20=20=20= =20(char*)=20SDATA=20(port),=20emacs_strerror=20(errno));=0A+=20=20=20=20= =20}=0A+=20#ifdef=20TIOCEXCL=0A+=20=20=20ioctl=20(fd,=20TIOCEXCL,=20= (char=20*)=200);=0A+=20#endif=0A+=20#endif=20/*=20WINDOWSNT=20=20*/=0A+=20= =0A+=20=20=20p->infd=20=3D=20fd;=0A+=20=20=20p->outfd=20=3D=20fd;=0A+=20=0A= +=20=20=20if=20(fd=20>=20max_process_desc)=0A+=20=20=20=20=20= max_process_desc=20=3D=20fd;=0A+=20=20=20chan_process[fd]=20=3D=20proc;=0A= +=20=0A+=20#ifdef=20WINDOWSNT=0A+=20=20=20cp=20=3D=20new_child=20();=0A+=20= =20=20if=20(!cp)=0A+=20=20=20=20=20error=20("Could=20not=20create=20= child");=0A+=20=20=20cp->fd=20=3D=20fd;=0A+=20=20=20cp->status=20=3D=20= STATUS_READ_ACKNOWLEDGED;=0A+=20=20=20fd_info[=20fd=20].hnd=20=3D=20hnd;=0A= +=20=20=20fd_info[=20fd=20].flags=20|=3D=0A+=20=20=20=20=20FILE_READ=20|=20= FILE_WRITE=20|=20FILE_BINARY=20|=20FILE_SERIAL;=0A+=20=20=20if=20= (fd_info[=20fd=20].cp=20!=3D=20NULL)=0A+=20=20=20=20=20{=0A+=20=20=20=20=20= =20=20error=20("fd_info[fd=20=3D=20%d]=20is=20already=20in=20use",=20= fd);=0A+=20=20=20=20=20}=0A+=20=20=20fd_info[=20fd=20].cp=20=3D=20cp;=0A= +=20=20=20cp->ovl_read.hEvent=20=3D=20CreateEvent=20(NULL,=20TRUE,=20= FALSE,=20NULL);=0A+=20=20=20if=20(cp->ovl_read.hEvent=20=3D=3D=20NULL)=0A= +=20=20=20=20=20=20=20error=20("Could=20not=20create=20read=20event");=0A= +=20=20=20cp->ovl_write.hEvent=20=3D=20CreateEvent=20(NULL,=20TRUE,=20= FALSE,=20NULL);=0A+=20=20=20if=20(cp->ovl_write.hEvent=20=3D=3D=20NULL)=0A= +=20=20=20=20=20=20=20error=20("Could=20not=20create=20write=20event");=0A= +=20#endif=20/*=20WINDOWSNT=20=20*/=0A+=20=0A+=20=20=20buffer=20=3D=20= Fplist_get=20(contact,=20QCbuffer);=0A+=20=20=20if=20(NILP=20(buffer))=0A= +=20=20=20=20=20buffer=20=3D=20name;=0A+=20=20=20buffer=20=3D=20= Fget_buffer_create=20(buffer);=0A+=20=20=20p->buffer=20=3D=20buffer;=0A+=20= =0A+=20=20=20p->childp=20=3D=20contact;=0A+=20=20=20p->plist=20=3D=20= Fcopy_sequence=20(Fplist_get=20(contact,=20QCplist));=0A+=20=20=20= p->type=20=3D=20Qserial;=0A+=20=20=20p->sentinel=20=3D=20Fplist_get=20= (contact,=20QCsentinel);=0A+=20=20=20p->filter=20=3D=20Fplist_get=20= (contact,=20QCfilter);=0A+=20=20=20p->log=20=3D=20Qnil;=0A+=20=20=20if=20= (tem=20=3D=20Fplist_get=20(contact,=20QCnoquery),=20!NILP=20(tem))=0A+=20= =20=20=20=20p->kill_without_query=20=3D=201;=0A+=20=20=20if=20(tem=20=3D=20= Fplist_get=20(contact,=20QCstop),=20!NILP=20(tem))=0A+=20=20=20=20=20= p->command=20=3D=20Qt;=0A+=20=20=20p->pty_flag=20=3D=200;=0A+=20=0A+=20=20= =20if=20(!EQ=20(p->command,=20Qt))=0A+=20=20=20=20=20{=0A+=20=20=20=20=20= =20=20FD_SET=20(fd,=20&input_wait_mask);=0A+=20=20=20=20=20=20=20FD_SET=20= (fd,=20&non_keyboard_wait_mask);=0A+=20=20=20=20=20}=0A+=20=0A+=20=20=20= if=20(BUFFERP=20(buffer))=0A+=20=20=20=20=20{=0A+=20=20=20=20=20=20=20= set_marker_both=20(p->mark,=20buffer,=0A+=20=09=09=20=20=20=20=20=20=20= BUF_ZV=20(XBUFFER=20(buffer)),=0A+=20=09=09=20=20=20=20=20=20=20= BUF_ZV_BYTE=20(XBUFFER=20(buffer)));=0A+=20=20=20=20=20}=0A+=20=0A+=20=20= =20tem=20=3D=20Fplist_member=20(contact,=20QCcoding);=0A+=20=20=20if=20= (!NILP=20(tem)=20&&=20(!CONSP=20(tem)=20||=20!CONSP=20(XCDR=20(tem))))=0A= +=20=20=20=20=20tem=20=3D=20Qnil;=0A+=20=0A+=20=20=20val=20=3D=20Qnil;=0A= +=20=20=20if=20(!NILP=20(tem))=0A+=20=20=20=20=20{=0A+=20=20=20=20=20=20=20= val=20=3D=20XCAR=20(XCDR=20(tem));=0A+=20=20=20=20=20=20=20if=20(CONSP=20= (val))=0A+=20=09val=20=3D=20XCAR=20(val);=0A+=20=20=20=20=20}=0A+=20=20=20= else=20if=20(!NILP=20(Vcoding_system_for_read))=0A+=20=20=20=20=20val=20= =3D=20Vcoding_system_for_read;=0A+=20=20=20else=20if=20((!NILP=20= (buffer)=20&&=20NILP=20(XBUFFER=20= (buffer)->enable_multibyte_characters))=0A+=20=09=20=20=20||=20(NILP=20= (buffer)=20&&=20NILP=20(buffer_defaults.enable_multibyte_characters)))=0A= +=20=20=20=20=20val=20=3D=20Qnil;=0A+=20=20=20p->decode_coding_system=20= =3D=20val;=0A+=20=0A+=20=20=20val=20=3D=20Qnil;=0A+=20=20=20if=20(!NILP=20= (tem))=0A+=20=20=20=20=20{=0A+=20=20=20=20=20=20=20val=20=3D=20XCAR=20= (XCDR=20(tem));=0A+=20=20=20=20=20=20=20if=20(CONSP=20(val))=0A+=20=09= val=20=3D=20XCDR=20(val);=0A+=20=20=20=20=20}=0A+=20=20=20else=20if=20= (!NILP=20(Vcoding_system_for_write))=0A+=20=20=20=20=20val=20=3D=20= Vcoding_system_for_write;=0A+=20=20=20else=20if=20((!NILP=20(buffer)=20= &&=20NILP=20(XBUFFER=20(buffer)->enable_multibyte_characters))=0A+=20=09=20= =20=20||=20(NILP=20(buffer)=20&&=20NILP=20= (buffer_defaults.enable_multibyte_characters)))=0A+=20=20=20=20=20val=20= =3D=20Qnil;=0A+=20=20=20p->encode_coding_system=20=3D=20val;=0A+=20=0A+=20= =20=20setup_process_coding_systems=20(proc);=0A+=20=20=20p->decoding_buf=20= =3D=20make_uninit_string=20(0);=0A+=20=20=20p->decoding_carryover=20=3D=20= 0;=0A+=20=20=20p->encoding_buf=20=3D=20make_uninit_string=20(0);=0A+=20=20= =20p->inherit_coding_system_flag=0A+=20=20=20=20=20=3D=20!(!NILP=20(tem)=20= ||=20NILP=20(buffer)=20||=20!inherit_process_coding_system);=0A+=20=0A+=20= =20=20Fserial_process_configure(nargs,=20args);=0A+=20=0A+=20=20=20= specpdl_ptr=20=3D=20specpdl=20+=20specpdl_count;=0A+=20=0A+=20=20=20= UNGCPRO;=0A+=20=20=20return=20proc;=0A+=20}=0A+=20=0A=20=20/*=20Create=20= a=20network=20stream/datagram=20client/server=20process.=20=20Treated=0A=20= =20=20=20=20exactly=20like=20a=20normal=20process=20when=20reading=20and=20= writing.=20=20Primary=0A=20=20=20=20=20differences=20are=20in=20status=20= display=20and=20process=20deletion.=20=20A=20network=0A=20=20=20=20=20= connection=20has=20no=20PID;=20you=20cannot=20signal=20it.=20=20All=20= you=20can=20do=20is=0A!=20=20=20=20stop/continue=20it=20and=20= deactivate/close=20it=20via=20delete-process=20=20*/=0A=20=20=0A=20=20= DEFUN=20("make-network-process",=20Fmake_network_process,=20= Smake_network_process,=0A=20=20=20=20=20=20=20=20=200,=20MANY,=200,=0A= ***************=20The=20stopped=20state=20is=20cleared=20by=20`continu=0A= ***=202752,2762=20****=0A=20=20=0A=20=20:filter=20FILTER=20--=20Install=20= FILTER=20as=20the=20process=20filter.=0A=20=20=0A-=20:filter-multibyte=20= BOOL=20--=20If=20BOOL=20is=20non-nil,=20strings=20given=20to=20the=0A-=20= process=20filter=20are=20multibyte,=20otherwise=20they=20are=20unibyte.=0A= -=20If=20this=20keyword=20is=20not=20specified,=20the=20strings=20are=20= multibyte=20if=0A-=20`default-enable-multibyte-characters'=20is=20= non-nil.=0A-=20=0A=20=20:sentinel=20SENTINEL=20--=20Install=20SENTINEL=20= as=20the=20process=20sentinel.=0A=20=20=0A=20=20:log=20LOG=20--=20= Install=20LOG=20as=20the=20server=20process=20log=20function.=20=20This=0A= ---=203436,3441=20----=0A***************=20usage:=20= (make-network-process=20&rest=20ARGS)=0A***=202865,2875=20****=0A=20=20=20= =20GCPRO1=20(contact);=0A=20=20=0A=20=20#ifdef=20WINDOWSNT=0A!=20=20=20= /*=20Ensure=20socket=20support=20is=20loaded=20if=20available.=20*/=0A=20= =20=20=20init_winsock=20(TRUE);=0A=20=20#endif=0A=20=20=0A!=20=20=20/*=20= :type=20TYPE=20=20(nil:=20stream,=20datagram=20*/=0A=20=20=20=20tem=20=3D=20= Fplist_get=20(contact,=20QCtype);=0A=20=20=20=20if=20(NILP=20(tem))=0A=20= =20=20=20=20=20socktype=20=3D=20SOCK_STREAM;=0A---=203544,3554=20----=0A=20= =20=20=20GCPRO1=20(contact);=0A=20=20=0A=20=20#ifdef=20WINDOWSNT=0A!=20=20= =20/*=20Ensure=20socket=20support=20is=20loaded=20if=20available.=20=20= */=0A=20=20=20=20init_winsock=20(TRUE);=0A=20=20#endif=0A=20=20=0A!=20=20= =20/*=20:type=20TYPE=20--=20stream=20(nil),=20datagram=20=20*/=0A=20=20=20= =20tem=20=3D=20Fplist_get=20(contact,=20QCtype);=0A=20=20=20=20if=20= (NILP=20(tem))=0A=20=20=20=20=20=20socktype=20=3D=20SOCK_STREAM;=0A= ***************=20usage:=20(make-network-process=20&rest=20ARGS)=0A***=20= 3365,3371=20****=0A=20=20=09=20the=20normal=20blocking=20calls=20to=20= open-network-stream=20handles=20this=20error=0A=20=20=09=20better.=20=20= */=0A=20=20=20=20=20=20=20=20if=20(is_non_blocking_client)=0A!=20=09=20=20= return=20Qnil;=0A=20=20=0A=20=20=20=20=20=20=20=20errno=20=3D=20xerrno;=0A= =20=20=20=20=20=20=20=20if=20(is_server)=0A---=204044,4050=20----=0A=20=20= =09=20the=20normal=20blocking=20calls=20to=20open-network-stream=20= handles=20this=20error=0A=20=20=09=20better.=20=20*/=0A=20=20=20=20=20=20= =20=20if=20(is_non_blocking_client)=0A!=20=09return=20Qnil;=0A=20=20=0A=20= =20=20=20=20=20=20=20errno=20=3D=20xerrno;=0A=20=20=20=20=20=20=20=20if=20= (is_server)=0A***************=20usage:=20(make-network-process=20&rest=20= ARGS)=0A***=203397,3402=20****=0A---=204076,4082=20----=0A=20=20=0A=20=20= =20=20p->childp=20=3D=20contact;=0A=20=20=20=20p->plist=20=3D=20= Fcopy_sequence=20(Fplist_get=20(contact,=20QCplist));=0A+=20=20=20= p->type=20=3D=20Qnetwork;=0A=20=20=0A=20=20=20=20p->buffer=20=3D=20= buffer;=0A=20=20=20=20p->sentinel=20=3D=20sentinel;=0A***************=20= usage:=20(make-network-process=20&rest=20ARGS)=0A***=203500,3506=20****=0A= =20=20=20=20=20=20=20=20}=0A=20=20=20=20=20=20else=20if=20(!NILP=20= (Vcoding_system_for_write))=0A=20=20=20=20=20=20=20=20val=20=3D=20= Vcoding_system_for_write;=0A!=20=20=20=20=20else=20if=20(NILP=20= (current_buffer->enable_multibyte_characters))=0A=20=20=20=20=20=20=20=20= val=20=3D=20Qnil;=0A=20=20=20=20=20=20else=0A=20=20=20=20=20=20=20=20{=0A= ---=204180,4187=20----=0A=20=20=20=20=20=20=20=20}=0A=20=20=20=20=20=20= else=20if=20(!NILP=20(Vcoding_system_for_write))=0A=20=20=20=20=20=20=20=20= val=20=3D=20Vcoding_system_for_write;=0A!=20=20=20=20=20else=20if=20= ((!NILP=20(buffer)=20&&=20NILP=20(XBUFFER=20= (buffer)->enable_multibyte_characters))=0A!=20=09=20=20=20=20=20||=20= (NILP=20(buffer)=20&&=20NILP=20= (buffer_defaults.enable_multibyte_characters)))=0A=20=20=20=20=20=20=20=20= val=20=3D=20Qnil;=0A=20=20=20=20=20=20else=0A=20=20=20=20=20=20=20=20{=0A= ***************=20server_accept_connection=20(server,=20channe=0A***=20= 4115,4120=20****=0A---=204796,4802=20----=0A=20=20=0A=20=20=20=20= p->childp=20=3D=20contact;=0A=20=20=20=20p->plist=20=3D=20Fcopy_sequence=20= (ps->plist);=0A+=20=20=20p->type=20=3D=20Qnetwork;=0A=20=20=0A=20=20=20=20= p->buffer=20=3D=20buffer;=0A=20=20=20=20p->sentinel=20=3D=20= ps->sentinel;=0A***************=20wait_reading_process_output=20= (time_limit,=0A***=204807,4813=20****=0A=20=20=09=09=20available=20now=20= and=20a=20closed=20pipe.=0A=20=20=09=09=20With=20luck,=20a=20closed=20= pipe=20will=20be=20accompanied=20by=0A=20=20=09=09=20subprocess=20= termination=20and=20SIGCHLD.=20=20*/=0A!=20=09=20=20=20=20=20=20else=20= if=20(nread=20=3D=3D=200=20&&=20!NETCONN_P=20(proc))=0A=20=20=09=09;=0A=20= =20#endif=20/*=20O_NDELAY=20*/=0A=20=20#endif=20/*=20O_NONBLOCK=20*/=0A= ---=205489,5495=20----=0A=20=20=09=09=20available=20now=20and=20a=20= closed=20pipe.=0A=20=20=09=09=20With=20luck,=20a=20closed=20pipe=20will=20= be=20accompanied=20by=0A=20=20=09=09=20subprocess=20termination=20and=20= SIGCHLD.=20=20*/=0A!=20=09=20=20=20=20=20=20else=20if=20(nread=20=3D=3D=20= 0=20&&=20!NETCONN_P=20(proc)=20&&=20!SERIALCONN_P=20(proc))=0A=20=20=09=09= ;=0A=20=20#endif=20/*=20O_NDELAY=20*/=0A=20=20#endif=20/*=20O_NONBLOCK=20= */=0A***************=20wait_reading_process_output=20(time_limit,=0A***=20= 4835,4841=20****=0A=20=20=09=20=20=20=20=20=20/*=20If=20we=20can=20= detect=20process=20termination,=20don't=20consider=20the=20process=0A=20=20= =09=09=20gone=20just=20because=20its=20pipe=20is=20closed.=20=20*/=0A=20=20= #ifdef=20SIGCHLD=0A!=20=09=20=20=20=20=20=20else=20if=20(nread=20=3D=3D=20= 0=20&&=20!NETCONN_P=20(proc))=0A=20=20=09=09;=0A=20=20#endif=0A=20=20=09=20= =20=20=20=20=20else=0A---=205517,5523=20----=0A=20=20=09=20=20=20=20=20=20= /*=20If=20we=20can=20detect=20process=20termination,=20don't=20consider=20= the=20process=0A=20=20=09=09=20gone=20just=20because=20its=20pipe=20is=20= closed.=20=20*/=0A=20=20#ifdef=20SIGCHLD=0A!=20=09=20=20=20=20=20=20else=20= if=20(nread=20=3D=3D=200=20&&=20!NETCONN_P=20(proc)=20&&=20!SERIALCONN_P=20= (proc))=0A=20=20=09=09;=0A=20=20#endif=0A=20=20=09=20=20=20=20=20=20else=0A= ***************=20send_process=20(proc,=20buf,=20len,=20object)=0A***=20= 5515,5522=20****=0A=20=20=09=09=20=20=20=20linepos++;=0A=20=20=09=09=20=20= ptr++;=0A=20=20=09=09}=0A!=20=09=20=20=20=20=20=20/*=20If=20we=20found=20= one,=20break=20the=20line=20there=0A!=20=09=09=20and=20put=20in=20a=20= C-d=20to=20force=20the=20buffer=20through.=20=20*/=0A=20=20=09=20=20=20=20= =20=20this=20=3D=20ptr=20-=20buf;=0A=20=20=09=20=20=20=20}=0A=20=20=0A= ---=206197,6204=20----=0A=20=20=09=09=20=20=20=20linepos++;=0A=20=20=09=09= =20=20ptr++;=0A=20=20=09=09}=0A!=20=09=20=20=20=20=20=20/*=20If=20we=20= found=20one,=20break=20the=20line=20there=20and=20put=20in=20an=0A!=20=09= =09=20EOF=20(C-d)=20to=20force=20the=20buffer=20through.=20=20*/=0A=20=20= =09=20=20=20=20=20=20this=20=3D=20ptr=20-=20buf;=0A=20=20=09=20=20=20=20= }=0A=20=20=0A***************=20send_process=20(proc,=20buf,=20len,=20= object)=0A***=205624,5630=20****=0A=20=20=09=20=20=20=20=20=20this=20-=3D=20= rv;=0A=20=20=09=20=20=20=20}=0A=20=20=0A!=20=09=20=20/*=20If=20we=20sent=20= just=20part=20of=20the=20string,=20put=20in=20an=20EOF=0A=20=20=09=20=20=20= =20=20to=20force=20it=20through,=20before=20we=20send=20the=20rest.=20=20= */=0A=20=20=09=20=20if=20(len=20>=200)=0A=20=20=09=20=20=20=20= Fprocess_send_eof=20(proc);=0A---=206306,6312=20----=0A=20=20=09=20=20=20= =20=20=20this=20-=3D=20rv;=0A=20=20=09=20=20=20=20}=0A=20=20=0A!=20=09=20= =20/*=20If=20we=20sent=20just=20part=20of=20the=20string,=20put=20in=20= an=20EOF=20(C-d)=0A=20=20=09=20=20=20=20=20to=20force=20it=20through,=20= before=20we=20send=20the=20rest.=20=20*/=0A=20=20=09=20=20if=20(len=20>=20= 0)=0A=20=20=09=20=20=20=20Fprocess_send_eof=20(proc);=0A***************=20= return=20t=20unconditionally.=20=20*/)=0A***=205744,5750=20****=0A=20=20=20= =20proc=20=3D=20get_process=20(process);=0A=20=20=20=20p=20=3D=20= XPROCESS=20(proc);=0A=20=20=0A!=20=20=20if=20(!EQ=20(p->childp,=20Qt))=0A= =20=20=20=20=20=20error=20("Process=20%s=20is=20not=20a=20subprocess",=0A= =20=20=09=20=20=20SDATA=20(p->name));=0A=20=20=20=20if=20(p->infd=20<=20= 0)=0A---=206426,6432=20----=0A=20=20=20=20proc=20=3D=20get_process=20= (process);=0A=20=20=20=20p=20=3D=20XPROCESS=20(proc);=0A=20=20=0A!=20=20=20= if=20(!EQ=20(p->type,=20Qreal))=0A=20=20=20=20=20=20error=20("Process=20= %s=20is=20not=20a=20subprocess",=0A=20=20=09=20=20=20SDATA=20(p->name));=0A= =20=20=20=20if=20(p->infd=20<=200)=0A***************=20= process_send_signal=20(process,=20signo,=20cur=0A***=205787,5793=20****=0A= =20=20=20=20proc=20=3D=20get_process=20(process);=0A=20=20=20=20p=20=3D=20= XPROCESS=20(proc);=0A=20=20=0A!=20=20=20if=20(!EQ=20(p->childp,=20Qt))=0A= =20=20=20=20=20=20error=20("Process=20%s=20is=20not=20a=20subprocess",=0A= =20=20=09=20=20=20SDATA=20(p->name));=0A=20=20=20=20if=20(p->infd=20<=20= 0)=0A---=206469,6475=20----=0A=20=20=20=20proc=20=3D=20get_process=20= (process);=0A=20=20=20=20p=20=3D=20XPROCESS=20(proc);=0A=20=20=0A!=20=20=20= if=20(!EQ=20(p->type,=20Qreal))=0A=20=20=20=20=20=20error=20("Process=20= %s=20is=20not=20a=20subprocess",=0A=20=20=09=20=20=20SDATA=20(p->name));=0A= =20=20=20=20if=20(p->infd=20<=200)=0A***************=20See=20function=20= `interrupt-process'=20for=20mor=0A***=206036,6047=20****=0A=20=20DEFUN=20= ("stop-process",=20Fstop_process,=20Sstop_process,=200,=202,=200,=0A=20=20= =20=20=20=20=20=20=20doc:=20/*=20Stop=20process=20PROCESS.=20=20May=20be=20= process=20or=20name=20of=20one.=0A=20=20See=20function=20= `interrupt-process'=20for=20more=20details=20on=20usage.=0A!=20If=20= PROCESS=20is=20a=20network=20process,=20inhibit=20handling=20of=20= incoming=20traffic.=20=20*/)=0A=20=20=20=20=20=20=20(process,=20= current_group)=0A=20=20=20=20=20=20=20Lisp_Object=20process,=20= current_group;=0A=20=20{=0A=20=20#ifdef=20HAVE_SOCKETS=0A!=20=20=20if=20= (PROCESSP=20(process)=20&&=20NETCONN_P=20(process))=0A=20=20=20=20=20=20= {=0A=20=20=20=20=20=20=20=20struct=20Lisp_Process=20*p;=0A=20=20=0A---=20= 6718,6730=20----=0A=20=20DEFUN=20("stop-process",=20Fstop_process,=20= Sstop_process,=200,=202,=200,=0A=20=20=20=20=20=20=20=20=20doc:=20/*=20= Stop=20process=20PROCESS.=20=20May=20be=20process=20or=20name=20of=20= one.=0A=20=20See=20function=20`interrupt-process'=20for=20more=20details=20= on=20usage.=0A!=20If=20PROCESS=20is=20a=20network=20or=20serial=20= process,=20inhibit=20handling=20of=20incoming=0A!=20traffic.=20=20*/)=0A=20= =20=20=20=20=20=20(process,=20current_group)=0A=20=20=20=20=20=20=20= Lisp_Object=20process,=20current_group;=0A=20=20{=0A=20=20#ifdef=20= HAVE_SOCKETS=0A!=20=20=20if=20(PROCESSP=20(process)=20&&=20(NETCONN_P=20= (process)=20||=20SERIALCONN_P=20(process)))=0A=20=20=20=20=20=20{=0A=20=20= =20=20=20=20=20=20struct=20Lisp_Process=20*p;=0A=20=20=0A***************=20= If=20PROCESS=20is=20a=20network=20process,=20inhibit=0A***=206067,6078=20= ****=0A=20=20DEFUN=20("continue-process",=20Fcontinue_process,=20= Scontinue_process,=200,=202,=200,=0A=20=20=20=20=20=20=20=20=20doc:=20/*=20= Continue=20process=20PROCESS.=20=20May=20be=20process=20or=20name=20of=20= one.=0A=20=20See=20function=20`interrupt-process'=20for=20more=20details=20= on=20usage.=0A!=20If=20PROCESS=20is=20a=20network=20process,=20resume=20= handling=20of=20incoming=20traffic.=20=20*/)=0A=20=20=20=20=20=20=20= (process,=20current_group)=0A=20=20=20=20=20=20=20Lisp_Object=20process,=20= current_group;=0A=20=20{=0A=20=20#ifdef=20HAVE_SOCKETS=0A!=20=20=20if=20= (PROCESSP=20(process)=20&&=20NETCONN_P=20(process))=0A=20=20=20=20=20=20= {=0A=20=20=20=20=20=20=20=20struct=20Lisp_Process=20*p;=0A=20=20=0A---=20= 6750,6762=20----=0A=20=20DEFUN=20("continue-process",=20= Fcontinue_process,=20Scontinue_process,=200,=202,=200,=0A=20=20=20=20=20=20= =20=20=20doc:=20/*=20Continue=20process=20PROCESS.=20=20May=20be=20= process=20or=20name=20of=20one.=0A=20=20See=20function=20= `interrupt-process'=20for=20more=20details=20on=20usage.=0A!=20If=20= PROCESS=20is=20a=20network=20or=20serial=20process,=20resume=20handling=20= of=20incoming=0A!=20traffic.=20*/)=0A=20=20=20=20=20=20=20(process,=20= current_group)=0A=20=20=20=20=20=20=20Lisp_Object=20process,=20= current_group;=0A=20=20{=0A=20=20#ifdef=20HAVE_SOCKETS=0A!=20=20=20if=20= (PROCESSP=20(process)=20&&=20(NETCONN_P=20(process)=20||=20SERIALCONN_P=20= (process)))=0A=20=20=20=20=20=20{=0A=20=20=20=20=20=20=20=20struct=20= Lisp_Process=20*p;=0A=20=20=0A***************=20If=20PROCESS=20is=20a=20= network=20process,=20resume=20=0A***=206083,6088=20****=0A---=20= 6767,6779=20----=0A=20=20=09{=0A=20=20=09=20=20FD_SET=20(p->infd,=20= &input_wait_mask);=0A=20=20=09=20=20FD_SET=20(p->infd,=20= &non_keyboard_wait_mask);=0A+=20#ifdef=20WINDOWSNT=0A+=20=09=20=20if=20= (fd_info[=20p->infd=20].flags=20&=20FILE_SERIAL)=0A+=20=09=20=20=20=20= PurgeComm=20(fd_info[=20p->infd=20].hnd,=20PURGE_RXABORT);=0A+=20#endif=0A= +=20#ifdef=20HAVE_TERMIOS=0A+=20=09=20=20tcflush=20(p->infd,=20= TCIFLUSH);=0A+=20#endif=0A=20=20=09}=0A=20=20=20=20=20=20=20=20= p->command=20=3D=20Qnil;=0A=20=20=20=20=20=20=20=20return=20process;=0A= ***************=20PROCESS=20may=20be=20a=20process,=20a=20buffer,=20the=20= =0A***=206268,6274=20****=0A=20=20nil,=20indicating=20the=20current=20= buffer's=20process.=0A=20=20If=20PROCESS=20is=20a=20network=20= connection,=20or=20is=20a=20process=20communicating=0A=20=20through=20a=20= pipe=20(as=20opposed=20to=20a=20pty),=20then=20you=20cannot=20send=20any=20= more=0A!=20text=20to=20PROCESS=20after=20you=20call=20this=20function.=20= =20*/)=0A=20=20=20=20=20=20=20(process)=0A=20=20=20=20=20=20=20= Lisp_Object=20process;=0A=20=20{=0A---=206959,6967=20----=0A=20=20nil,=20= indicating=20the=20current=20buffer's=20process.=0A=20=20If=20PROCESS=20= is=20a=20network=20connection,=20or=20is=20a=20process=20communicating=0A= =20=20through=20a=20pipe=20(as=20opposed=20to=20a=20pty),=20then=20you=20= cannot=20send=20any=20more=0A!=20text=20to=20PROCESS=20after=20you=20= call=20this=20function.=0A!=20If=20PROCESS=20is=20a=20serial=20process,=20= wait=20until=20all=20output=20written=20to=20the=0A!=20process=20has=20= been=20transmitted=20to=20the=20serial=20port.=20=20*/)=0A=20=20=20=20=20= =20=20(process)=0A=20=20=20=20=20=20=20Lisp_Object=20process;=0A=20=20{=0A= ***************=20text=20to=20PROCESS=20after=20you=20call=20this=20func=0A= ***=206298,6303=20****=0A---=206991,7004=20----=0A=20=20#else=0A=20=20=20= =20if=20(XPROCESS=20(proc)->pty_flag)=0A=20=20=20=20=20=20send_process=20= (proc,=20"\004",=201,=20Qnil);=0A+=20=20=20else=20if=20(XPROCESS=20= (proc)->type=20=3D=3D=20Qserial)=0A+=20=20=20=20=20{=0A+=20#ifdef=20= HAVE_TERMIOS=0A+=20=20=20=20=20=20=20if=20(tcdrain=20(XPROCESS=20= (proc)->outfd)=20!=3D=200)=0A+=20=09error=20("tcdrain()=20failed:=20%s",=20= emacs_strerror=20(errno));=0A+=20#endif=20/*=20HAVE_TERMIOS=20=20*/=0A+=20= =20=20=20=20=20=20/*=20Do=20nothing=20on=20Windows=20because=20writes=20= are=20blocking.=20=20*/=0A+=20=20=20=20=20}=0A=20=20=20=20else=0A=20=20=20= =20=20=20{=0A=20=20=20=20=20=20=20=20int=20old_outfd,=20new_outfd;=0A= ***************=20text=20to=20PROCESS=20after=20you=20call=20this=20func=0A= ***=206307,6313=20****=0A=20=20=09=20for=20communication=20with=20the=20= subprocess,=20call=20shutdown=20to=20cause=20EOF.=0A=20=20=09=20(In=20= some=20old=20system,=20shutdown=20to=20socketpair=20doesn't=20work.=0A=20= =20=09=20Then=20we=20just=20can't=20win.)=20=20*/=0A!=20=20=20=20=20=20=20= if=20(XPROCESS=20(proc)->pid=20=3D=3D=200=0A=20=20=09=20=20||=20XPROCESS=20= (proc)->outfd=20=3D=3D=20XPROCESS=20(proc)->infd)=0A=20=20=09shutdown=20= (XPROCESS=20(proc)->outfd,=201);=0A=20=20=20=20=20=20=20=20/*=20In=20= case=20of=20socketpair,=20outfd=20=3D=3D=20infd,=20so=20don't=20close=20= it.=20=20*/=0A---=207008,7014=20----=0A=20=20=09=20for=20communication=20= with=20the=20subprocess,=20call=20shutdown=20to=20cause=20EOF.=0A=20=20=09= =20(In=20some=20old=20system,=20shutdown=20to=20socketpair=20doesn't=20= work.=0A=20=20=09=20Then=20we=20just=20can't=20win.)=20=20*/=0A!=20=20=20= =20=20=20=20if=20(XPROCESS=20(proc)->type=20=3D=3D=20Qnetwork=0A=20=20=09= =20=20||=20XPROCESS=20(proc)->outfd=20=3D=3D=20XPROCESS=20(proc)->infd)=0A= =20=20=09shutdown=20(XPROCESS=20(proc)->outfd,=201);=0A=20=20=20=20=20=20= =20=20/*=20In=20case=20of=20socketpair,=20outfd=20=3D=3D=20infd,=20so=20= don't=20close=20it.=20=20*/=0A***************=20kill_buffer_processes=20= (buffer)=0A***=206351,6357=20****=0A=20=20=20=20=20=20=20=20if=20= (PROCESSP=20(proc)=0A=20=20=09=20=20&&=20(NILP=20(buffer)=20||=20EQ=20= (XPROCESS=20(proc)->buffer,=20buffer)))=0A=20=20=09{=0A!=20=09=20=20if=20= (NETCONN_P=20(proc))=0A=20=20=09=20=20=20=20Fdelete_process=20(proc);=0A=20= =20=09=20=20else=20if=20(XPROCESS=20(proc)->infd=20>=3D=200)=0A=20=20=09=20= =20=20=20process_send_signal=20(proc,=20SIGHUP,=20Qnil,=201);=0A---=20= 7052,7058=20----=0A=20=20=20=20=20=20=20=20if=20(PROCESSP=20(proc)=0A=20=20= =09=20=20&&=20(NILP=20(buffer)=20||=20EQ=20(XPROCESS=20(proc)->buffer,=20= buffer)))=0A=20=20=09{=0A!=20=09=20=20if=20(NETCONN_P=20(proc)=20||=20= SERIALCONN_P=20(proc))=0A=20=20=09=20=20=20=20Fdelete_process=20(proc);=0A= =20=20=09=20=20else=20if=20(XPROCESS=20(proc)->infd=20>=3D=200)=0A=20=20=09= =20=20=20=20process_send_signal=20(proc,=20SIGHUP,=20Qnil,=201);=0A= ***************=20sigchld_handler=20(signo)=0A***=206460,6466=20****=0A=20= =20=09{=0A=20=20=09=20=20proc=20=3D=20XCDR=20(XCAR=20(tail));=0A=20=20=09= =20=20p=20=3D=20XPROCESS=20(proc);=0A!=20=09=20=20if=20(EQ=20(p->childp,=20= Qt)=20&&=20p->pid=20=3D=3D=20pid)=0A=20=20=09=20=20=20=20break;=0A=20=20=09= =20=20p=20=3D=200;=0A=20=20=09}=0A---=207161,7167=20----=0A=20=20=09{=0A=20= =20=09=20=20proc=20=3D=20XCDR=20(XCAR=20(tail));=0A=20=20=09=20=20p=20=3D=20= XPROCESS=20(proc);=0A!=20=09=20=20if=20(EQ=20(p->type,=20Qreal)=20&&=20= p->pid=20=3D=3D=20pid)=0A=20=20=09=20=20=20=20break;=0A=20=20=09=20=20p=20= =3D=200;=0A=20=20=09}=0A***************=20status_notify=20= (deleting_process)=0A***=206682,6688=20****=0A=20=20=09=20=20while=20(!=20= EQ=20(p->filter,=20Qt)=0A=20=20=09=09=20&&=20!=20EQ=20(p->status,=20= Qconnect)=0A=20=20=09=09=20&&=20!=20EQ=20(p->status,=20Qlisten)=0A!=20=09= =09=20&&=20!=20EQ=20(p->command,=20Qt)=20=20/*=20Network=20process=20not=20= stopped.=20=20*/=0A=20=20=09=09=20&&=20p->infd=20>=3D=200=0A=20=20=09=09=20= &&=20p=20!=3D=20deleting_process=0A=20=20=09=09=20&&=20= read_process_output=20(proc,=20p->infd)=20>=200);=0A---=207383,7390=20= ----=0A=20=20=09=20=20while=20(!=20EQ=20(p->filter,=20Qt)=0A=20=20=09=09=20= &&=20!=20EQ=20(p->status,=20Qconnect)=0A=20=20=09=09=20&&=20!=20EQ=20= (p->status,=20Qlisten)=0A!=20=09=09=20/*=20Network=20or=20serial=20= process=20not=20stopped:=20=20*/=0A!=20=09=09=20&&=20!=20EQ=20= (p->command,=20Qt)=0A=20=20=09=09=20&&=20p->infd=20>=3D=200=0A=20=20=09=09= =20&&=20p=20!=3D=20deleting_process=0A=20=20=09=09=20&&=20= read_process_output=20(proc,=20p->infd)=20>=200);=0A***************=20= syms_of_process=20()=0A***=207069,7074=20****=0A---=207771,7809=20----=0A= =20=20=20=20Qdatagram=20=3D=20intern=20("datagram");=0A=20=20=20=20= staticpro=20(&Qdatagram);=0A=20=20=0A+=20=20=20QCport=20=3D=20intern=20= (":port");=0A+=20=20=20staticpro=20(&QCport);=0A+=20=20=20QCspeed=20=3D=20= intern=20(":speed");=0A+=20=20=20staticpro=20(&QCspeed);=0A+=20=20=20= QCprocess=20=3D=20intern=20(":process");=0A+=20=20=20staticpro=20= (&QCprocess);=0A+=20=0A+=20=20=20QCbytesize=20=3D=20intern=20= (":bytesize");=0A+=20=20=20staticpro=20(&QCbytesize);=0A+=20=20=20= QCstopbits=20=3D=20intern=20(":stopbits");=0A+=20=20=20staticpro=20= (&QCstopbits);=0A+=20=20=20QCparity=20=3D=20intern=20(":parity");=0A+=20=20= =20staticpro=20(&QCparity);=0A+=20=20=20Qodd=20=3D=20intern=20("odd");=0A= +=20=20=20staticpro=20(&Qodd);=0A+=20=20=20Qeven=20=3D=20intern=20= ("even");=0A+=20=20=20staticpro=20(&Qeven);=0A+=20=20=20QCflowcontrol=20= =3D=20intern=20(":flowcontrol");=0A+=20=20=20staticpro=20= (&QCflowcontrol);=0A+=20=20=20Qhw=20=3D=20intern=20("hw");=0A+=20=20=20= staticpro=20(&Qhw);=0A+=20=20=20Qsw=20=3D=20intern=20("sw");=0A+=20=20=20= staticpro=20(&Qsw);=0A+=20=20=20QCsummary=20=3D=20intern=20(":summary");=0A= +=20=20=20staticpro=20(&QCsummary);=0A+=20=0A+=20=20=20Qreal=20=3D=20= intern=20("real");=0A+=20=20=20staticpro=20(&Qreal);=0A+=20=20=20= Qnetwork=20=3D=20intern=20("network");=0A+=20=20=20staticpro=20= (&Qnetwork);=0A+=20=20=20Qserial=20=3D=20intern=20("serial");=0A+=20=20=20= staticpro=20(&Qserial);=0A+=20=0A=20=20=20=20QCname=20=3D=20intern=20= (":name");=0A=20=20=20=20staticpro=20(&QCname);=0A=20=20=20=20QCbuffer=20= =3D=20intern=20(":buffer");=0A***************=20The=20variable=20takes=20= effect=20when=20`start-pr=0A***=207166,7171=20****=0A---=207901,7908=20= ----=0A=20=20=20=20defsubr=20(&Slist_processes);=0A=20=20=20=20defsubr=20= (&Sprocess_list);=0A=20=20=20=20defsubr=20(&Sstart_process);=0A+=20=20=20= defsubr=20(&Sserial_process_configure);=0A+=20=20=20defsubr=20= (&Smake_serial_process);=0A=20=20#ifdef=20HAVE_SOCKETS=0A=20=20=20=20= defsubr=20(&Sset_network_process_option);=0A=20=20=20=20defsubr=20= (&Smake_network_process);=0A***************=20The=20variable=20takes=20= effect=20when=20`start-pr=0A***=207195,7201=20****=0A=20=20=20=20defsubr=20= (&Sprocess_send_eof);=0A=20=20=20=20defsubr=20(&Ssignal_process);=0A=20=20= =20=20defsubr=20(&Swaiting_for_user_input_p);=0A!=20/*=20=20defsubr=20= (&Sprocess_connection);=20*/=0A=20=20=20=20defsubr=20= (&Sset_process_coding_system);=0A=20=20=20=20defsubr=20= (&Sprocess_coding_system);=0A=20=20=20=20defsubr=20= (&Sset_process_filter_multibyte);=0A---=207932,7938=20----=0A=20=20=20=20= defsubr=20(&Sprocess_send_eof);=0A=20=20=20=20defsubr=20= (&Ssignal_process);=0A=20=20=20=20defsubr=20= (&Swaiting_for_user_input_p);=0A!=20=20=20defsubr=20(&Sprocess_type);=0A=20= =20=20=20defsubr=20(&Sset_process_coding_system);=0A=20=20=20=20defsubr=20= (&Sprocess_coding_system);=0A=20=20=20=20defsubr=20= (&Sset_process_filter_multibyte);=0AIndex:=20src/process.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/src/process.h,v=0Aretrieving=20revision=201.43=0A= diff=20-c=20-p=20-r1.43=20process.h=0A***=20src/process.h=0925=20Mar=20= 2008=2017:35:47=20-0000=091.43=0A---=20src/process.h=0921=20Apr=202008=20= 19:56:19=20-0000=0A***************=20Boston,=20MA=2002110-1301,=20USA.=20= =20*/=0A***=2029,36=20****=0A=20=20/*=20This=20structure=20records=20= information=20about=20a=20subprocess=0A=20=20=20=20=20or=20network=20= connection.=0A=20=20=0A!=20=20=20=20Every=20field=20in=20this=20= structure=20except=20for=20the=20first=20two=0A!=20=20=20=20must=20be=20= a=20Lisp_Object,=20for=20GC's=20sake.=20=20*/=0A=20=20=0A=20=20struct=20= Lisp_Process=0A=20=20=20=20{=0A---=2029,36=20----=0A=20=20/*=20This=20= structure=20records=20information=20about=20a=20subprocess=0A=20=20=20=20= =20or=20network=20connection.=0A=20=20=0A!=20=20=20=20Every=20field=20in=20= this=20structure=20after=20the=20first=20two=20up=20to=20`pid'=20must=0A= !=20=20=20=20be=20a=20Lisp_Object,=20for=20GC's=20sake.=20=20*/=0A=20=20=0A= =20=20struct=20Lisp_Process=0A=20=20=20=20{=0A***************=20struct=20= Lisp_Process=0A***=2053,63=20****=0A=20=20=20=20=20=20Lisp_Object=20log;=0A= =20=20=20=20=20=20/*=20Buffer=20that=20output=20is=20going=20to=20*/=0A=20= =20=20=20=20=20Lisp_Object=20buffer;=0A!=20=20=20=20=20/*=20t=20if=20= this=20is=20a=20real=20child=20process.=0A!=20=20=20=20=20=20=20=20For=20= a=20net=20connection,=20it=20is=20a=20plist=20based=20on=20the=20= arguments=20to=20make-network-process.=20=20*/=0A=20=20=20=20=20=20= Lisp_Object=20childp;=0A=20=20=20=20=20=20/*=20Plist=20for=20programs=20= to=20keep=20per-process=20state=20information,=20parameters,=20etc.=20=20= */=0A=20=20=20=20=20=20Lisp_Object=20plist;=0A=20=20=20=20=20=20/*=20= Marker=20set=20to=20end=20of=20last=20buffer-inserted=20output=20from=20= this=20process=20*/=0A=20=20=20=20=20=20Lisp_Object=20mark;=0A=20=20=20=20= =20=20/*=20Symbol=20indicating=20status=20of=20process.=0A---=2053,66=20= ----=0A=20=20=20=20=20=20Lisp_Object=20log;=0A=20=20=20=20=20=20/*=20= Buffer=20that=20output=20is=20going=20to=20*/=0A=20=20=20=20=20=20= Lisp_Object=20buffer;=0A!=20=20=20=20=20/*=20t=20if=20this=20is=20a=20= real=20child=20process.=20=20For=20a=20network=20or=20serial=0A!=20=20=20= =20=20=20=20=20connection,=20it=20is=20a=20plist=20based=20on=20the=20= arguments=20to=0A!=20=20=20=20=20=20=20=20make-network-process=20or=20= make-serial-process.=20*/=0A=20=20=20=20=20=20Lisp_Object=20childp;=0A=20= =20=20=20=20=20/*=20Plist=20for=20programs=20to=20keep=20per-process=20= state=20information,=20parameters,=20etc.=20=20*/=0A=20=20=20=20=20=20= Lisp_Object=20plist;=0A+=20=20=20=20=20/*=20Symbol=20indicating=20the=20= type=20of=20process:=20real,=20network,=20serial=20=20*/=0A+=20=20=20=20=20= Lisp_Object=20type;=0A=20=20=20=20=20=20/*=20Marker=20set=20to=20end=20= of=20last=20buffer-inserted=20output=20from=20this=20process=20*/=0A=20=20= =20=20=20=20Lisp_Object=20mark;=0A=20=20=20=20=20=20/*=20Symbol=20= indicating=20status=20of=20process.=0A***************=20struct=20= Lisp_Process=0A***=2080,86=20****=0A=20=20=0A=20=20=20=20=20=20/*=20= Number=20of=20this=20process.=0A=20=20=20=20=20=20=20=20=20= allocate_process=20assumes=20this=20is=20the=20first=20non-Lisp_Object=20= field.=0A!=20=20=20=20=20=20=20=20A=20value=200=20is=20used=20for=20= pseudo-processes=20such=20as=20network=20connections.=20=20*/=0A=20=20=20= =20=20=20pid_t=20pid;=0A=20=20=20=20=20=20/*=20Descriptor=20by=20which=20= we=20read=20from=20this=20process=20*/=0A=20=20=20=20=20=20int=20infd;=0A= ---=2083,90=20----=0A=20=20=0A=20=20=20=20=20=20/*=20Number=20of=20this=20= process.=0A=20=20=20=20=20=20=20=20=20allocate_process=20assumes=20this=20= is=20the=20first=20non-Lisp_Object=20field.=0A!=20=20=20=20=20=20=20=20A=20= value=200=20is=20used=20for=20pseudo-processes=20such=20as=20network=20= or=20serial=0A!=20=20=20=20=20=20=20=20connections.=20=20*/=0A=20=20=20=20= =20=20pid_t=20pid;=0A=20=20=20=20=20=20/*=20Descriptor=20by=20which=20we=20= read=20from=20this=20process=20*/=0A=20=20=20=20=20=20int=20infd;=0A= Index:=20src/w32.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/src/w32.c,v=0Aretrieving=20revision=201.135=0Adiff=20= -c=20-p=20-r1.135=20w32.c=0A***=20src/w32.c=0910=20Apr=202008=2011:37:56=20= -0000=091.135=0A---=20src/w32.c=0921=20Apr=202008=2019:56:23=20-0000=0A= ***************=20_sys_read_ahead=20(int=20fd)=0A***=203798,3807=20****=0A= =20=20=20=20if=20(cp=20=3D=3D=20NULL=20||=20cp->fd=20!=3D=20fd=20||=20= cp->status=20!=3D=20STATUS_READ_READY)=0A=20=20=20=20=20=20return=20= STATUS_READ_ERROR;=0A=20=20=0A!=20=20=20if=20((fd_info[fd].flags=20&=20= (FILE_PIPE=20|=20FILE_SOCKET))=20=3D=3D=200=0A=20=20=20=20=20=20=20=20||=20= (fd_info[fd].flags=20&=20FILE_READ)=20=3D=3D=200)=0A=20=20=20=20=20=20{=0A= !=20=20=20=20=20=20=20DebPrint=20(("_sys_read_ahead:=20internal=20error:=20= fd=20%d=20is=20not=20a=20pipe=20or=20socket!\n",=20fd));=0A=20=20=20=20=20= =20=20=20abort=20();=0A=20=20=20=20=20=20}=0A=20=20=0A---=203798,3807=20= ----=0A=20=20=20=20if=20(cp=20=3D=3D=20NULL=20||=20cp->fd=20!=3D=20fd=20= ||=20cp->status=20!=3D=20STATUS_READ_READY)=0A=20=20=20=20=20=20return=20= STATUS_READ_ERROR;=0A=20=20=0A!=20=20=20if=20((fd_info[fd].flags=20&=20= (FILE_PIPE=20|=20FILE_SERIAL=20|=20FILE_SOCKET))=20=3D=3D=200=0A=20=20=20= =20=20=20=20=20||=20(fd_info[fd].flags=20&=20FILE_READ)=20=3D=3D=200)=0A=20= =20=20=20=20=20{=0A!=20=20=20=20=20=20=20DebPrint=20(("_sys_read_ahead:=20= internal=20error:=20fd=20%d=20is=20not=20a=20pipe,=20serial=20port,=20or=20= socket!\n",=20fd));=0A=20=20=20=20=20=20=20=20abort=20();=0A=20=20=20=20=20= =20}=0A=20=20=0A***************=20_sys_read_ahead=20(int=20fd)=0A***=20= 3815,3821=20****=0A=20=20=09=20reporting=20that=20input=20is=20= available;=20we=20need=20this=20because=20Windows=2095=0A=20=20=09=20= connects=20DOS=20programs=20to=20pipes=20by=20making=20the=20pipe=20= appear=20to=20be=0A=20=20=09=20the=20normal=20console=20stdout=20-=20as=20= a=20result=20most=20DOS=20programs=20will=0A!=20=09=20write=20to=20= stdout=20without=20buffering,=20ie.=20=20one=20character=20at=20a=0A=20=20= =09=20time.=20=20Even=20some=20W32=20programs=20do=20this=20-=20"dir"=20= in=20a=20command=0A=20=20=09=20shell=20on=20NT=20is=20very=20slow=20if=20= we=20don't=20do=20this.=20*/=0A=20=20=20=20=20=20=20=20if=20(rc=20>=200)=0A= ---=203815,3821=20----=0A=20=20=09=20reporting=20that=20input=20is=20= available;=20we=20need=20this=20because=20Windows=2095=0A=20=20=09=20= connects=20DOS=20programs=20to=20pipes=20by=20making=20the=20pipe=20= appear=20to=20be=0A=20=20=09=20the=20normal=20console=20stdout=20-=20as=20= a=20result=20most=20DOS=20programs=20will=0A!=20=09=20write=20to=20= stdout=20without=20buffering,=20i.e.=20one=20character=20at=20a=0A=20=20=09= =20time.=20=20Even=20some=20W32=20programs=20do=20this=20-=20"dir"=20in=20= a=20command=0A=20=20=09=20shell=20on=20NT=20is=20very=20slow=20if=20we=20= don't=20do=20this.=20*/=0A=20=20=20=20=20=20=20=20if=20(rc=20>=200)=0A= ***************=20_sys_read_ahead=20(int=20fd)=0A***=203831,3836=20****=0A= ---=203831,3859=20----=0A=20=20=09=20=20=20=20=20=20Sleep=20(0);=0A=20=20= =09}=0A=20=20=20=20=20=20}=0A+=20=20=20else=20if=20(fd_info[fd].flags=20= &=20FILE_SERIAL)=0A+=20=20=20=20=20{=0A+=20=20=20=20=20=20=20HANDLE=20= hnd=20=3D=20fd_info[fd].hnd;=0A+=20=20=20=20=20=20=20OVERLAPPED=20*ovl=20= =3D=20&fd_info[fd].cp->ovl_read;=0A+=20=20=20=20=20=20=20COMMTIMEOUTS=20= ct;=0A+=20=0A+=20=20=20=20=20=20=20/*=20Configure=20timeouts=20for=20= blocking=20read.=20=20*/=0A+=20=20=20=20=20=20=20if=20(!GetCommTimeouts=20= (hnd,=20&ct))=0A+=20=09return=20STATUS_READ_ERROR;=0A+=20=20=20=20=20=20=20= ct.ReadIntervalTimeout=09=09=3D=200;=0A+=20=20=20=20=20=20=20= ct.ReadTotalTimeoutMultiplier=09=3D=200;=0A+=20=20=20=20=20=20=20= ct.ReadTotalTimeoutConstant=09=3D=200;=0A+=20=20=20=20=20=20=20if=20= (!SetCommTimeouts=20(hnd,=20&ct))=0A+=20=09return=20STATUS_READ_ERROR;=0A= +=20=0A+=20=20=20=20=20=20=20if=20(!ReadFile=20(hnd,=20&cp->chr,=20= sizeof=20(char),=20(DWORD*)=20&rc,=20ovl))=0A+=20=09{=0A+=20=09=20=20if=20= (GetLastError=20()=20!=3D=20ERROR_IO_PENDING)=0A+=20=09=20=20=20=20= return=20STATUS_READ_ERROR;=0A+=20=09=20=20if=20(!GetOverlappedResult=20= (hnd,=20ovl,=20(DWORD*)=20&rc,=20TRUE))=0A+=20=09=20=20=20=20return=20= STATUS_READ_ERROR;=0A+=20=09}=0A+=20=20=20=20=20}=0A=20=20#ifdef=20= HAVE_SOCKETS=0A=20=20=20=20else=20if=20(fd_info[fd].flags=20&=20= FILE_SOCKET)=0A=20=20=20=20=20=20{=0A***************=20sys_read=20(int=20= fd,=20char=20*=20buffer,=20unsigne=0A***=203902,3908=20****=0A=20=20=20=20= =20=20=20=20return=20-1;=0A=20=20=20=20=20=20}=0A=20=20=0A!=20=20=20if=20= (fd=20<=20MAXDESC=20&&=20fd_info[fd].flags=20&=20(FILE_PIPE=20|=20= FILE_SOCKET))=0A=20=20=20=20=20=20{=0A=20=20=20=20=20=20=20=20= child_process=20*cp=20=3D=20fd_info[fd].cp;=0A=20=20=0A---=203925,3933=20= ----=0A=20=20=20=20=20=20=20=20return=20-1;=0A=20=20=20=20=20=20}=0A=20=20= =0A!=20=20=20/*=20TODO:=20count=20=3D=3D=200=20is=20not=20handled=20=20= */=0A!=20=0A!=20=20=20if=20(fd=20<=20MAXDESC=20&&=20fd_info[fd].flags=20= &=20(FILE_PIPE=20|=20FILE_SOCKET=20|=20FILE_SERIAL))=0A=20=20=20=20=20=20= {=0A=20=20=20=20=20=20=20=20child_process=20*cp=20=3D=20fd_info[fd].cp;=0A= =20=20=0A***************=20sys_read=20(int=20fd,=20char=20*=20buffer,=20= unsigne=0A***=203973,3978=20****=0A---=203998,4049=20----=0A=20=20=09=20=20= =20=20=20=20if=20(to_read=20>=200)=0A=20=20=09=09nchars=20+=3D=20_read=20= (fd,=20buffer,=20to_read);=0A=20=20=09=20=20=20=20}=0A+=20=09=20=20else=20= if=20(fd_info[fd].flags=20&=20FILE_SERIAL)=0A+=20=09=20=20=20=20{=0A+=20=09= =20=20=20=20=20=20HANDLE=20hnd=20=3D=20fd_info[fd].hnd;=0A+=20=09=20=20=20= =20=20=20OVERLAPPED=20*ovl=20=3D=20&fd_info[fd].cp->ovl_read;=0A+=20=09=20= =20=20=20=20=20DWORD=20err=20=3D=200;=0A+=20=09=20=20=20=20=20=20int=20= rc=20=3D=200;=0A+=20=09=20=20=20=20=20=20COMMTIMEOUTS=20ct;=0A+=20=0A+=20= =09=20=20=20=20=20=20if=20(count=20>=200)=0A+=20=09=09{=0A+=20=09=09=20=20= /*=20Configure=20timeouts=20for=20non-blocking=20read.=20=20*/=0A+=20=09=09= =20=20if=20(!GetCommTimeouts=20(hnd,=20&ct))=0A+=20=09=09=20=20=20=20{=0A= +=20=09=09=20=20=20=20=20=20errno=20=3D=20EIO;=0A+=20=09=09=20=20=20=20=20= =20return=20-1;=0A+=20=09=09=20=20=20=20}=0A+=20=09=09=20=20= ct.ReadIntervalTimeout=09=20=3D=20MAXDWORD;=0A+=20=09=09=20=20= ct.ReadTotalTimeoutMultiplier=09=20=3D=200;=0A+=20=09=09=20=20= ct.ReadTotalTimeoutConstant=09=20=3D=200;=0A+=20=09=09=20=20if=20= (!SetCommTimeouts=20(hnd,=20&ct))=0A+=20=09=09=20=20=20=20{=0A+=20=09=09=20= =20=20=20=20=20errno=20=3D=20EIO;=0A+=20=09=09=20=20=20=20=20=20return=20= -1;=0A+=20=09=09=20=20=20=20}=0A+=20=0A+=20=09=09=20=20if=20(!ResetEvent=20= (ovl->hEvent))=0A+=20=09=09=20=20=20=20{=0A+=20=09=09=20=20=20=20=20=20= errno=20=3D=20EIO;=0A+=20=09=09=20=20=20=20=20=20return=20-1;=0A+=20=09=09= =20=20=20=20}=0A+=20=09=09=20=20if=20(!ReadFile=20(hnd,=20buffer,=20= count,=20(DWORD*)=20&rc,=20ovl))=0A+=20=09=09=20=20=20=20{=0A+=20=09=09=20= =20=20=20=20=20if=20(GetLastError=20()=20!=3D=20ERROR_IO_PENDING)=0A+=20=09= =09=09{=0A+=20=09=09=09=20=20errno=20=3D=20EIO;=0A+=20=09=09=09=20=20= return=20-1;=0A+=20=09=09=09}=0A+=20=09=09=20=20=20=20=20=20if=20= (!GetOverlappedResult=20(hnd,=20ovl,=20(DWORD*)=20&rc,=20TRUE))=0A+=20=09= =09=09{=0A+=20=09=09=09=20=20errno=20=3D=20EIO;=0A+=20=09=09=09=20=20= return=20-1;=0A+=20=09=09=09}=0A+=20=09=09=20=20=20=20}=0A+=20=09=09=20=20= nchars=20+=3D=20rc;=0A+=20=09=09}=0A+=20=09=20=20=20=20}=0A=20=20#ifdef=20= HAVE_SOCKETS=0A=20=20=09=20=20else=20/*=20FILE_SOCKET=20*/=0A=20=20=09=20= =20=20=20{=0A***************=20sys_read=20(int=20fd,=20char=20*=20= buffer,=20unsigne=0A***=204034,4039=20****=0A---=204105,4113=20----=0A=20= =20=20=20return=20nchars;=0A=20=20}=0A=20=20=0A+=20/*=20=46rom=20= w32xfns.c=20*/=0A+=20extern=20HANDLE=20interrupt_handle;=0A+=20=0A=20=20= /*=20For=20now,=20don't=20bother=20with=20a=20non-blocking=20mode=20*/=0A= =20=20int=0A=20=20sys_write=20(int=20fd,=20const=20void=20*=20buffer,=20= unsigned=20int=20count)=0A***************=20sys_write=20(int=20fd,=20= const=20void=20*=20buffer,=20=0A***=204046,4052=20****=0A=20=20=20=20=20=20= =20=20return=20-1;=0A=20=20=20=20=20=20}=0A=20=20=0A!=20=20=20if=20(fd=20= <=20MAXDESC=20&&=20fd_info[fd].flags=20&=20(FILE_PIPE=20|=20= FILE_SOCKET))=0A=20=20=20=20=20=20{=0A=20=20=20=20=20=20=20=20if=20= ((fd_info[fd].flags=20&=20FILE_WRITE)=20=3D=3D=200)=0A=20=20=09{=0A---=20= 4120,4126=20----=0A=20=20=20=20=20=20=20=20return=20-1;=0A=20=20=20=20=20= =20}=0A=20=20=0A!=20=20=20if=20(fd=20<=20MAXDESC=20&&=20= fd_info[fd].flags=20&=20(FILE_PIPE=20|=20FILE_SOCKET=20|=20FILE_SERIAL))=0A= =20=20=20=20=20=20{=0A=20=20=20=20=20=20=20=20if=20((fd_info[fd].flags=20= &=20FILE_WRITE)=20=3D=3D=200)=0A=20=20=09{=0A***************=20sys_write=20= (int=20fd,=20const=20void=20*=20buffer,=20=0A***=204087,4092=20****=0A= ---=204161,4202=20----=0A=20=20=09}=0A=20=20=20=20=20=20}=0A=20=20=0A+=20= =20=20if=20(fd=20<=20MAXDESC=20&&=20fd_info[fd].flags=20&=20FILE_SERIAL)=0A= +=20=20=20=20=20{=0A+=20=20=20=20=20=20=20HANDLE=20hnd=20=3D=20(HANDLE)=20= _get_osfhandle=20(fd);=0A+=20=20=20=20=20=20=20OVERLAPPED=20*ovl=20=3D=20= &fd_info[fd].cp->ovl_write;=0A+=20=20=20=20=20=20=20HANDLE=20wait_hnd[2]=20= =3D=20{=20interrupt_handle,=20ovl->hEvent=20};=0A+=20=20=20=20=20=20=20= DWORD=20active=20=3D=200;=0A+=20=0A+=20=20=20=20=20=20=20if=20= (!WriteFile=20(hnd,=20buffer,=20count,=20(DWORD*)=20&nchars,=20ovl))=0A+=20= =09{=0A+=20=09=20=20if=20(GetLastError=20()=20!=3D=20ERROR_IO_PENDING)=0A= +=20=09=20=20=20=20{=0A+=20=09=20=20=20=20=20=20errno=20=3D=20EIO;=0A+=20= =09=20=20=20=20=20=20return=20-1;=0A+=20=09=20=20=20=20}=0A+=20=09=20=20= if=20(detect_input_pending=20())=0A+=20=09=20=20=20=20active=20=3D=20= MsgWaitForMultipleObjects=20(2,=20wait_hnd,=20FALSE,=20INFINITE,=0A+=20=09= =09=09=09=09=09QS_ALLINPUT);=0A+=20=09=20=20else=0A+=20=09=20=20=20=20= active=20=3D=20WaitForMultipleObjects=20(2,=20wait_hnd,=20FALSE,=20= INFINITE);=0A+=20=09=20=20if=20(active=20=3D=3D=20WAIT_OBJECT_0)=0A+=20=09= =20=20=20=20{=20/*=20User=20pressed=20C-g,=20cancel=20write,=20then=20= leave.=20=20Don't=20bother=0A+=20=09=09=20cleaning=20up=20as=20we=20may=20= only=20get=20stuck=20in=20buggy=20drivers.=20*/=0A+=20=09=20=20=20=20=20=20= PurgeComm=20(hnd,=20PURGE_TXABORT=20|=20PURGE_TXCLEAR);=0A+=20=09=20=20=20= =20=20=20CancelIo=20(hnd);=0A+=20=09=20=20=20=20=20=20errno=20=3D=20EIO;=0A= +=20=09=20=20=20=20=20=20return=20-1;=0A+=20=09=20=20=20=20}=0A+=20=09=20= =20if=20(active=20=3D=3D=20WAIT_OBJECT_0=20+=201=0A+=20=09=20=20=20=20=20= =20&&=20!GetOverlappedResult=20(hnd,=20ovl,=20(DWORD*)=20&nchars,=20= TRUE))=0A+=20=09=20=20=20=20{=0A+=20=09=20=20=20=20=20=20errno=20=3D=20= EIO;=0A+=20=09=20=20=20=20=20=20return=20-1;=0A+=20=09=20=20=20=20}=0A+=20= =09}=0A+=20=20=20=20=20}=0A+=20=20=20else=0A=20=20#ifdef=20HAVE_SOCKETS=0A= =20=20=20=20if=20(fd=20<=20MAXDESC=20&&=20fd_info[fd].flags=20&=20= FILE_SOCKET)=0A=20=20=20=20=20=20{=0AIndex:=20src/w32.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0ARCS=20file:=20= /sources/emacs/emacs/src/w32.h,v=0Aretrieving=20revision=201.25=0Adiff=20= -c=20-p=20-r1.25=20w32.h=0A***=20src/w32.h=098=20Jan=202008=2020:44:15=20= -0000=091.25=0A---=20src/w32.h=0921=20Apr=202008=2019:56:23=20-0000=0A= ***************=20enum=20{=0A***=2062,68=20****=0A=20=20};=0A=20=20=0A=20= =20/*=20This=20structure=20is=20used=20for=20both=20pipes=20and=20= sockets;=20for=0A!=20=20=20=20a=20socket,=20the=20process=20handle=20in=20= pi=20is=20NULL.=20*/=0A=20=20typedef=20struct=20_child_process=0A=20=20{=0A= =20=20=20=20int=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= fd;=0A---=2062,68=20----=0A=20=20};=0A=20=20=0A=20=20/*=20This=20= structure=20is=20used=20for=20both=20pipes=20and=20sockets;=20for=0A!=20=20= =20=20a=20socket,=20the=20process=20handle=20in=20procinfo=20is=20NULL.=20= */=0A=20=20typedef=20struct=20_child_process=0A=20=20{=0A=20=20=20=20int=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20fd;=0A= ***************=20typedef=20struct=20_child_process=0A***=2074,79=20****=0A= ---=2074,81=20----=0A=20=20=20=20PROCESS_INFORMATION=20=20=20procinfo;=0A= =20=20=20=20volatile=20int=20=20=20=20=20=20=20=20=20=20status;=0A=20=20=20= =20char=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20chr;=0A+=20=20= =20OVERLAPPED=20=20=20=20=20=20=20=20=20=20=20=20ovl_read;=0A+=20=20=20= OVERLAPPED=20=20=20=20=20=20=20=20=20=20=20=20ovl_write;=0A=20=20}=20= child_process;=0A=20=20=0A=20=20#define=20MAXDESC=20FD_SETSIZE=0A= ***************=20extern=20filedesc=20fd_info=20[=20MAXDESC=20];=0A***=20= 101,106=20****=0A---=20103,109=20----=0A=20=20#define=20FILE_PIPE=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=200x0100=0A=20=20#define=20FILE_SOCKET=20= =20=20=20=20=20=20=20=20=20=20=20=200x0200=0A=20=20#define=20FILE_NDELAY=20= =20=20=20=20=20=20=20=20=20=20=20=200x0400=0A+=20#define=20FILE_SERIAL=20= =20=20=20=20=20=20=20=20=20=20=20=200x0800=0A=20=20=0A=20=20extern=20= child_process=20*=20new_child=20(void);=0A=20=20extern=20void=20= delete_child=20(child_process=20*cp);=0A= --Apple-Mail-7-722248515 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit --Apple-Mail-7-722248515--