Browse Source

moved src files to a separate dir

Vladislav Gritsenko 6 years ago
parent
commit
c769e3badb
14 changed files with 387 additions and 424 deletions
  1. 16 0
      .editorconfig
  2. 9 9
      CMakeLists.txt
  3. 347 347
      include/enet.h
  4. 15 10
      misc/build-singleheader.js
  5. 0 58
      premake4.lua
  6. 0 0
      src/callbacks.c
  7. 0 0
      src/compress.c
  8. 0 0
      src/host.c
  9. 0 0
      src/list.c
  10. 0 0
      src/packet.c
  11. 0 0
      src/peer.c
  12. 0 0
      src/protocol.c
  13. 0 0
      src/unix.c
  14. 0 0
      src/win32.c

+ 16 - 0
.editorconfig

@@ -0,0 +1,16 @@
+# EditorConfig is awesome: http://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+# Unix-style newlines with a newline ending every file
+[*]
+end_of_line = lf
+insert_final_newline = true
+
+# Set default charset
+charset = utf-8
+
+# 4 space indentation
+indent_style = space
+indent_size = 4

+ 9 - 9
CMakeLists.txt

@@ -71,15 +71,15 @@ set(INCLUDE_FILES
 )
 
 set(SOURCE_FILES
-    callbacks.c
-    compress.c
-    host.c
-    list.c
-    packet.c
-    peer.c
-    protocol.c
-    unix.c
-    win32.c)
+    src/callbacks.c
+    src/compress.c
+    src/host.c
+    src/list.c
+    src/packet.c
+    src/peer.c
+    src/protocol.c
+    src/unix.c
+    src/win32.c)
 
 source_group(include FILES ${INCLUDE_FILES})
 source_group(source FILES ${SOURCE_FILES})

File diff suppressed because it is too large
+ 347 - 347
include/enet.h


+ 15 - 10
misc/build-singleheader.js

@@ -11,6 +11,7 @@ function include_enet(src) {
     return src
         .split('\n')
         .map(line => {
+            // include enet header files for header
             if (line.indexOf('#include "enet/') !== -1) {
                 return read_file('include/' + line.slice(10, -1))
             }
@@ -24,10 +25,12 @@ function filter_libs(src, unqiue_lib_list) {
     return src
         .split('\n')
         .map((line, i) => {
+            // remove references to enet across all file
             if (line.indexOf('#include "enet/') !== -1) {
                 return ''
             }
 
+            // reduce amount of includes to get rid of dublications
             if (line.indexOf('#include <') !== -1) {
                 if (!unqiue_lib_list[line.slice(10, -1)]) {
                     unqiue_lib_list[line.slice(10, -1)] = 1;
@@ -38,7 +41,9 @@ function filter_libs(src, unqiue_lib_list) {
                 }
             }
 
-            return line.replace(/\s*$/, '')
+            return line
+                .replace(/\s*$/, '') /* remove trailing spaces */
+                .replace(/^\s{3}(\w)/, '    $1') /* make sure all tabulated lines have minumun 4 spaces */
         })
         .join('\n')
 }
@@ -64,15 +69,15 @@ function attach_src(src, unqiue_lib_list, sources_list, scr_template) {
 }
 
 let sources = [
-    'callbacks.c',
-    'compress.c',
-    'host.c',
-    'list.c',
-    'packet.c',
-    'peer.c',
-    'protocol.c',
-    'unix.c',
-    'win32.c',
+    'src/callbacks.c',
+    'src/compress.c',
+    'src/host.c',
+    'src/list.c',
+    'src/packet.c',
+    'src/peer.c',
+    'src/protocol.c',
+    'src/unix.c',
+    'src/win32.c',
 ]
 
 let scr_template = [

+ 0 - 58
premake4.lua

@@ -1,58 +0,0 @@
-solution "enet"
-    configurations { "Debug", "Release" }
-    platforms { "x32", "x64" }
-
-    project "enet_static"
-        kind "StaticLib"
-        language "C"
-
-        files { "*.c" }
-
-        includedirs { "include/" }
-
-        configuration "Debug"
-            targetsuffix "d"
-
-            defines({ "DEBUG" })
-
-            flags { "Symbols" }
-
-        configuration "Release"
-            defines({ "NDEBUG" })
-
-            flags { "Optimize" }
-
-        configuration { "Debug", "x64" }
-            targetsuffix "64d"
-
-        configuration { "Release", "x64" }
-            targetsuffix "64"
-
-    project "enet"
-        kind "SharedLib"
-        language "C"
-
-        files { "*.c" }
-
-        includedirs { "include/" }
-
-        defines({"ENET_DLL=1" })
-
-        configuration "Debug"
-            targetsuffix "d"
-
-            defines({ "DEBUG" })
-
-            flags { "Symbols" }
-
-        configuration "Release"
-            defines({ "NDEBUG" })
-
-            flags { "Optimize" }
-
-        configuration { "Debug", "x64" }
-            targetsuffix "64d"
-
-        configuration { "Release", "x64" }
-            targetsuffix "64"
-

+ 0 - 0
callbacks.c → src/callbacks.c


+ 0 - 0
compress.c → src/compress.c


+ 0 - 0
host.c → src/host.c


+ 0 - 0
list.c → src/list.c


+ 0 - 0
packet.c → src/packet.c


+ 0 - 0
peer.c → src/peer.c


+ 0 - 0
protocol.c → src/protocol.c


+ 0 - 0
unix.c → src/unix.c


+ 0 - 0
win32.c → src/win32.c


Some files were not shown because too many files changed in this diff