362303298a
In order to separate compiler from build system, C++ Modules, as implemented in GCC introduces a communication channel between those two entities. This is implemented by libcody. It is anticipated that other implementations will also implement this protocol, or use libcody to provide it. * Makefile.def: Add libcody. * configure.ac: Add libcody. * Makefile.in: Regenerated. * configure: Regenerated. gcc/ * Makefile.in (CODYINC, CODYLIB, CODYLIB_H): New. Use them. libcody/ * configure.ac: New. * CMakeLists.txt: New. * CODING.md: New. * CONTRIB.md: New. * LICENSE: New. * LICENSE.gcc: New. * Makefile.in: New. * Makesub.in: New. * README.md: New. * buffer.cc: New. * build-aux/config.guess: New. * build-aux/config.sub: New. * build-aux/install-sh: New. * client.cc: New. * cmake/libcody-config-ix.cmake * cody.hh: New. * config.h.in: New. * config.m4: New. * configure: New. * configure.ac: New. * dox.cfg.in: New. * fatal.cc: New. * gdbinit.in: New. * internal.hh: New. * netclient.cc: New. * netserver.cc: New. * packet.cc: New. * resolver.cc: New. * server.cc: New. * tests/01-serialize/connect.cc: New. * tests/01-serialize/decoder.cc: New. * tests/01-serialize/encoder.cc: New. * tests/02-comms/client-1.cc: New. * tests/02-comms/pivot-1.cc: New. * tests/02-comms/server-1.cc: New. * tests/Makesub.in: New. * tests/jouster: New.
49 lines
1022 B
C++
49 lines
1022 B
C++
// CODYlib -*- mode:c++ -*-
|
|
// Copyright (C) 2020 Nathan Sidwell, nathan@acm.org
|
|
// License: Apache v2.0
|
|
|
|
// Test message encoding, both string quoting and continuation lines
|
|
|
|
// RUN: $subdir$stem |& ezio $test
|
|
// RUN-END:
|
|
// The ¯ is utf8-encoded as c2 af
|
|
// CHECK-NEXT: ^bob 'frob dob''\n¯\\'$
|
|
// CHECK-NEXT: ^2 ;$
|
|
// CHECK-NEXT: ^3$
|
|
// CHECK-NEXT: $EOF
|
|
|
|
// Cody
|
|
#include "cody.hh"
|
|
|
|
using namespace Cody;
|
|
|
|
int main (int, char *[])
|
|
{
|
|
Detail::MessageBuffer writer;
|
|
|
|
writer.BeginLine ();
|
|
writer.AppendWord ("bob");
|
|
writer.AppendWord ("frob dob", true);
|
|
writer.Append ("\n\xc2\xaf\\", true);
|
|
writer.EndLine ();
|
|
|
|
writer.PrepareToWrite ();
|
|
while (int err = writer.Write (2))
|
|
if (err != EAGAIN && err != EINTR)
|
|
break;
|
|
|
|
writer.BeginLine ();
|
|
writer.Append ("2", true);
|
|
writer.EndLine ();
|
|
writer.BeginLine ();
|
|
writer.Append ("3", true);
|
|
writer.EndLine ();
|
|
|
|
writer.PrepareToWrite ();
|
|
while (int err = writer.Write (2))
|
|
if (err != EAGAIN && err != EINTR)
|
|
break;
|
|
|
|
return 0;
|
|
}
|