Comments (0)

Files changed (7)

File File.hh Modified

View file
  • Ignore whitespace
  • Hide word diff
   File (File&& mv) noexcept :name(::std::move(mv.name)){} // No need to copy fd.
 
   template <class R>
-  explicit File (ReceiveBuffer<R>& buf):name(buf.GiveString_view())
-  {
+  explicit File (ReceiveBuffer<R>& buf):name(buf.GiveString_view()){
     fd=::open(name.c_str(),O_WRONLY|O_CREAT|O_TRUNC
               ,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
     if(fd<0)throw failure("File::File open ")<<name<<" "<<errno;
 
   ~File () {if(0!=fd)::close(fd);}
 
-  bool Marshal (SendBuffer& buf,bool=false) const
-  {
+  bool Marshal (SendBuffer& buf,bool=false) const{
     struct stat sb;
     if(::stat(name.c_str(),&sb)<0)throw failure("File::Marshal stat ")<<name;
     if(sb.st_mtime>previous_updatedtime){
   ::std::string const& Name () const {return name;}
 };
 }
-

File IO.hh Modified

View file
  • Ignore whitespace
  • Hide word diff
 inline DWORD Write (HANDLE hndl,void const* data,int len)
 {
   DWORD bytesWritten=0;
-  if(!WriteFile(hndl,static_cast<char const*>(data),len
-                ,&bytesWritten,nullptr)){
+  if(!WriteFile(hndl,static_cast<char const*>(data),len,&bytesWritten,nullptr))
     throw failure("Write--WriteFile ")<<GetLastError();
-  }
   return bytesWritten;
 }
 
 inline DWORD Read (HANDLE hndl,void* data,int len)
 {
   DWORD bytesRead=0;
-  if (!ReadFile(hndl,static_cast<char*>(data),len
-                ,&bytesRead,nullptr)){
+  if (!ReadFile(hndl,static_cast<char*>(data),len,&bytesRead,nullptr))
     throw failure("Read--ReadFile")<<GetLastError();
-  }
   return bytesRead;
 }
-
 #else
-
 inline int Write (int fd,void const* data,int len)
 {
   int rc=::write(fd,data,len);

File example/makefile Modified

View file
  • Ignore whitespace
  • Hide word diff
 
 clean:
 	rm -f $(TARGETS)
-

File makefile Modified

View file
  • Ignore whitespace
  • Hide word diff
-CFLAGS= -Os -Wshadow -Wundef -W -Wall -Wextra
-CXXFLAGS= -std=c++17 $(CFLAGS) -Wreorder
+CFLAGS=-Os -Wshadow -Wundef -W -Wall -Wextra
+CXXFLAGS=-std=c++17 $(CFLAGS) -Wreorder
 
 CXX=g++7
 #CXX=clang++ -stdlib=libc++
 
 LIBS=-L./ -L/usr/lib
 
-all: libhome.a subdirs
-
-.PHONY: subdirs
-subdirs:
-	$(MAKE) -C tiers
-	$(MAKE) -C example
+TIERS:= tiers/cmwAmbassador tiers/genz
+TARGETS:= libhome.a $(TIERS)
+all: $(TARGETS)
 
 objects = quicklz.o marshalling_integer.o
 libhome.a: $(objects)
-	ar r $@ $(objects)
+	ar rc $@ $(objects)
+
+#zz.middle_messages_back.hh: account_info.hh remote.mdl cmw.req
+#	genz 2 /usr/home/brian/onwards/tiers/cmw.req
+
+tiers/cmwAmbassador: tiers/cmwAmbassador.cc libhome.a
+	$(CXX) -o $@ $(CXXFLAGS) -I. $@.cc libhome.a
+	size $@
+
+tiers/genz: tiers/genz.cc libhome.a
+	$(CXX) -o $@ $(CXXFLAGS) -I. $@.cc libhome.a
+	size $@
 
 clean:
-	rm -f $(objects) libhome.*
-	$(MAKE) -C tiers clean
-	$(MAKE) -C example clean
+	rm -f $(objects) $(TARGETS)
 
 INSTALL_DIR=/usr/local
 includes=close_socket.hh connect_wrapper.hh getaddrinfo_wrapper.hh tcp_server.hh udp_stuff.hh ErrorWords.hh File.hh IO*.hh marshalling_integer.hh poll_wrapper.hh SendBuffer*.hh Formatting.hh ReceiveBuffer*.hh cmw_complex.hh platforms.hh empty_container.hh quicklz.h
 
 install:
-	$(MAKE) -C tiers install
-	cp -f libhome.a $(INSTALL_DIR)/lib
 	cp -f $(includes) $(INSTALL_DIR)/include
+	cp -f libhome.a $(INSTALL_DIR)/lib
+	cp -f $(TIERS) $(INSTALL_DIR)/bin
 
 uninstall:
-	$(MAKE) -C tiers uninstall
-	rm -f $(INSTALL_DIR)/lib/libhome.a
 	cd $(INSTALL_DIR)/include && rm -f $(includes)
-
+	rm -f $(INSTALL_DIR)/lib/libhome.a

File string_join.hh Modified

View file
  • Ignore whitespace
  • Hide word diff
 
  public:
   string_join (::std::string_view str1
-	       ,::std::string_view str2):s1(str1),s2(str2)
-  {}
+               ,::std::string_view str2):s1(str1),s2(str2) {}
 
   void Marshal (::cmw::SendBuffer& buf,bool=false) const
   {

File tiers/genz.cc Modified

View file
  • Ignore whitespace
  • Hide word diff
 
 using namespace ::cmw;
 
-int main (int argc,char** argv)
-{
+int main (int argc,char** argv){
   try{
     if(argc<3 || argc>5)
       throw failure("Usage: genz account-number .req-file-path [node] [port]");

File tiers/makefile Deleted

  • Ignore whitespace
  • Hide word diff
-CXX=g++7
-#CXX=clang++ -stdlib=libc++
-
-CXXFLAGS= -std=c++17 -I.. -Os -Wshadow -Wundef -Wreorder -W -Wall -Wextra
-
-TARGETS := cmwAmbassador genz
-all: $(TARGETS)
-
-#zz.middle_messages_back.hh: account_info.hh remote.mdl cmw.req
-#	genz 1 /usr/home/brian/onwards/tiers/cmw.req
-
-cmwAmbassador: cmwAmbassador.cc zz.middle_messages_back.hh ../libhome.a
-	$(CXX) -o $@ $(CXXFLAGS) $< ../libhome.a
-	size $@
-
-genz: genz.cc ../libhome.a
-	$(CXX) -o $@ $(CXXFLAGS) $< ../libhome.a
-	size $@
-
-clean:
-	rm -f $(TARGETS)
-
-INSTALL_DIR=/usr/local
-install:
-	cp -f $(TARGETS) $(INSTALL_DIR)/bin
-
-uninstall:
-	cd $(INSTALL_DIR)/bin/ && rm -f $(TARGETS)
-