@mytechtoday/augment-extensions 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/augment-extensions/coding-standards/c/CHANGELOG.md +55 -0
- package/augment-extensions/coding-standards/c/LICENSE +22 -0
- package/augment-extensions/coding-standards/c/README.md +167 -0
- package/augment-extensions/coding-standards/c/config/defaults.json +26 -0
- package/augment-extensions/coding-standards/c/config/examples/embedded.yaml +25 -0
- package/augment-extensions/coding-standards/c/config/examples/systems.json +31 -0
- package/augment-extensions/coding-standards/c/config/schema.json +244 -0
- package/augment-extensions/coding-standards/c/docs/API.md +613 -0
- package/augment-extensions/coding-standards/c/docs/CONFIGURATION.md +259 -0
- package/augment-extensions/coding-standards/c/docs/USER_GUIDE.md +567 -0
- package/augment-extensions/coding-standards/c/examples/drivers/Makefile +33 -0
- package/augment-extensions/coding-standards/c/examples/drivers/README.md +192 -0
- package/augment-extensions/coding-standards/c/examples/drivers/dma-example.c +224 -0
- package/augment-extensions/coding-standards/c/examples/drivers/example.dts +64 -0
- package/augment-extensions/coding-standards/c/examples/drivers/platform-driver.c +174 -0
- package/augment-extensions/coding-standards/c/examples/embedded/README.md +167 -0
- package/augment-extensions/coding-standards/c/examples/embedded/gpio-control.c +172 -0
- package/augment-extensions/coding-standards/c/examples/embedded/timer-isr.c +198 -0
- package/augment-extensions/coding-standards/c/examples/embedded/uart-communication.c +212 -0
- package/augment-extensions/coding-standards/c/examples/kernel/Makefile +82 -0
- package/augment-extensions/coding-standards/c/examples/kernel/README.md +168 -0
- package/augment-extensions/coding-standards/c/examples/kernel/char-device.c +198 -0
- package/augment-extensions/coding-standards/c/examples/kernel/proc-file.c +131 -0
- package/augment-extensions/coding-standards/c/examples/kernel/simple-module.c +111 -0
- package/augment-extensions/coding-standards/c/examples/legacy/Makefile +62 -0
- package/augment-extensions/coding-standards/c/examples/legacy/README.md +255 -0
- package/augment-extensions/coding-standards/c/examples/legacy/c89-to-c11-migration.c +268 -0
- package/augment-extensions/coding-standards/c/examples/legacy/compatibility-layer.c +239 -0
- package/augment-extensions/coding-standards/c/examples/networking/Makefile +35 -0
- package/augment-extensions/coding-standards/c/examples/networking/README.md +207 -0
- package/augment-extensions/coding-standards/c/examples/networking/protocol-parser.c +270 -0
- package/augment-extensions/coding-standards/c/examples/networking/tcp-server.c +197 -0
- package/augment-extensions/coding-standards/c/examples/networking/udp-multicast.c +220 -0
- package/augment-extensions/coding-standards/c/examples/realtime/Makefile +53 -0
- package/augment-extensions/coding-standards/c/examples/realtime/README.md +199 -0
- package/augment-extensions/coding-standards/c/examples/realtime/deadline-monitoring.c +260 -0
- package/augment-extensions/coding-standards/c/examples/realtime/priority-scheduling.c +258 -0
- package/augment-extensions/coding-standards/c/examples/systems/Makefile +34 -0
- package/augment-extensions/coding-standards/c/examples/systems/README.md +123 -0
- package/augment-extensions/coding-standards/c/examples/systems/ipc-pipes.c +181 -0
- package/augment-extensions/coding-standards/c/examples/systems/process-management.c +153 -0
- package/augment-extensions/coding-standards/c/examples/systems/signal-handling.c +162 -0
- package/augment-extensions/coding-standards/c/module.json +149 -0
- package/augment-extensions/coding-standards/c/rules/categories/drivers.md +635 -0
- package/augment-extensions/coding-standards/c/rules/categories/embedded.md +510 -0
- package/augment-extensions/coding-standards/c/rules/categories/kernel.md +653 -0
- package/augment-extensions/coding-standards/c/rules/categories/legacy.md +526 -0
- package/augment-extensions/coding-standards/c/rules/categories/networking.md +735 -0
- package/augment-extensions/coding-standards/c/rules/categories/realtime.md +631 -0
- package/augment-extensions/coding-standards/c/rules/categories/systems.md +586 -0
- package/augment-extensions/coding-standards/c/rules/universal/const-correctness.md +275 -0
- package/augment-extensions/coding-standards/c/rules/universal/documentation.md +251 -0
- package/augment-extensions/coding-standards/c/rules/universal/error-handling.md +250 -0
- package/augment-extensions/coding-standards/c/rules/universal/header-guards.md +254 -0
- package/augment-extensions/coding-standards/c/rules/universal/memory-safety.md +233 -0
- package/augment-extensions/coding-standards/c/rules/universal/naming.md +146 -0
- package/augment-extensions/coding-standards/c/src/conflict-detector.ts +461 -0
- package/augment-extensions/coding-standards/c/src/prompt-generator.ts +307 -0
- package/augment-extensions/coding-standards/c/src/rule-evaluator.ts +307 -0
- package/augment-extensions/coding-standards/c/src/rule-override.ts +427 -0
- package/augment-extensions/coding-standards/c/src/template-engine.ts +217 -0
- package/augment-extensions/coding-standards/c/templates/prompts/drivers.txt +191 -0
- package/augment-extensions/coding-standards/c/templates/prompts/embedded.txt +164 -0
- package/augment-extensions/coding-standards/c/templates/prompts/kernel.txt +175 -0
- package/augment-extensions/coding-standards/c/templates/prompts/legacy.txt +280 -0
- package/augment-extensions/coding-standards/c/templates/prompts/networking.txt +259 -0
- package/augment-extensions/coding-standards/c/templates/prompts/realtime.txt +219 -0
- package/augment-extensions/coding-standards/c/templates/prompts/systems.txt +147 -0
- package/augment-extensions/coding-standards/c/tests/integration/category-specific.test.ts +356 -0
- package/augment-extensions/coding-standards/c/tests/integration/end-to-end-workflow.test.ts +377 -0
- package/augment-extensions/coding-standards/c/tests/performance/benchmarks.test.ts +407 -0
- package/augment-extensions/coding-standards/c/tests/unit/config-manager.test.ts +345 -0
- package/augment-extensions/coding-standards/c/tests/unit/conflict-detector.test.ts +294 -0
- package/augment-extensions/coding-standards/c/tests/unit/prompt-generator.test.ts +174 -0
- package/augment-extensions/coding-standards/c/tests/unit/registry.test.ts +313 -0
- package/augment-extensions/coding-standards/c/tests/unit/rule-evaluator.test.ts +318 -0
- package/augment-extensions/coding-standards/c/tests/unit/rule-override.test.ts +326 -0
- package/augment-extensions/coding-standards/c/tests/unit/template-engine.test.ts +314 -0
- package/augment-extensions/coding-standards/go/CHARACTER-COUNT-REPORT.md +135 -0
- package/augment-extensions/coding-standards/go/PHASE1-COMPLETION.md +146 -0
- package/augment-extensions/coding-standards/go/PHASE4-COMPLETION.md +184 -0
- package/augment-extensions/coding-standards/go/README.md +200 -0
- package/augment-extensions/coding-standards/go/VALIDATION-CHECKLIST.md +154 -0
- package/augment-extensions/coding-standards/go/config/examples/example-cli.json +15 -0
- package/augment-extensions/coding-standards/go/config/examples/example-microservices.json +21 -0
- package/augment-extensions/coding-standards/go/config/examples/example-multi-category.yaml +24 -0
- package/augment-extensions/coding-standards/go/config/examples/example-web.json +15 -0
- package/augment-extensions/coding-standards/go/config/schema.json +110 -0
- package/augment-extensions/coding-standards/go/docs/CATEGORIES.md +221 -0
- package/augment-extensions/coding-standards/go/docs/CONFIGURATION.md +198 -0
- package/augment-extensions/coding-standards/go/docs/TROUBLESHOOTING.md +285 -0
- package/augment-extensions/coding-standards/go/examples/cli/cobra-app.go +287 -0
- package/augment-extensions/coding-standards/go/examples/cloud-native-app.go +217 -0
- package/augment-extensions/coding-standards/go/examples/devops-tool.go +250 -0
- package/augment-extensions/coding-standards/go/examples/distributed-system.go +247 -0
- package/augment-extensions/coding-standards/go/examples/microservices/grpc-service.go +253 -0
- package/augment-extensions/coding-standards/go/examples/rest-api.go +270 -0
- package/augment-extensions/coding-standards/go/examples/web/http-server.go +224 -0
- package/augment-extensions/coding-standards/go/module.json +139 -0
- package/augment-extensions/coding-standards/go/rules/categories/api-development/api-versioning.md +149 -0
- package/augment-extensions/coding-standards/go/rules/categories/api-development/rate-limiting.md +209 -0
- package/augment-extensions/coding-standards/go/rules/categories/api-development/rest-api-design.md +183 -0
- package/augment-extensions/coding-standards/go/rules/categories/cloud-native/cloud-config.md +193 -0
- package/augment-extensions/coding-standards/go/rules/categories/cloud-native/health-checks.md +231 -0
- package/augment-extensions/coding-standards/go/rules/categories/cloud-native/kubernetes.md +180 -0
- package/augment-extensions/coding-standards/go/rules/categories/devops-tooling/automation.md +179 -0
- package/augment-extensions/coding-standards/go/rules/categories/devops-tooling/ci-cd-integration.md +147 -0
- package/augment-extensions/coding-standards/go/rules/categories/devops-tooling/infrastructure-as-code.md +231 -0
- package/augment-extensions/coding-standards/go/rules/categories/distributed-systems/caching.md +150 -0
- package/augment-extensions/coding-standards/go/rules/categories/distributed-systems/consensus.md +187 -0
- package/augment-extensions/coding-standards/go/rules/categories/distributed-systems/event-sourcing.md +246 -0
- package/augment-extensions/coding-standards/go/rules/cli/command-parsing.md +264 -0
- package/augment-extensions/coding-standards/go/rules/cli/configuration.md +268 -0
- package/augment-extensions/coding-standards/go/rules/cli/cross-platform.md +324 -0
- package/augment-extensions/coding-standards/go/rules/microservices/distributed-tracing.md +253 -0
- package/augment-extensions/coding-standards/go/rules/microservices/grpc.md +257 -0
- package/augment-extensions/coding-standards/go/rules/microservices/metrics.md +278 -0
- package/augment-extensions/coding-standards/go/rules/microservices/service-discovery.md +249 -0
- package/augment-extensions/coding-standards/go/rules/universal/code-organization.md +221 -0
- package/augment-extensions/coding-standards/go/rules/universal/documentation.md +269 -0
- package/augment-extensions/coding-standards/go/rules/universal/performance.md +323 -0
- package/augment-extensions/coding-standards/go/rules/universal/testing.md +162 -0
- package/augment-extensions/coding-standards/go/rules/web/graceful-shutdown.md +249 -0
- package/augment-extensions/coding-standards/go/rules/web/http-handlers.md +164 -0
- package/augment-extensions/coding-standards/go/rules/web/middleware.md +234 -0
- package/augment-extensions/coding-standards/go/rules/web/routing.md +251 -0
- package/augment-extensions/coding-standards/go/templates/prompts/api.md +160 -0
- package/augment-extensions/coding-standards/go/templates/prompts/cli.md +225 -0
- package/augment-extensions/coding-standards/go/templates/prompts/cloud-native.md +121 -0
- package/augment-extensions/coding-standards/go/templates/prompts/devops.md +146 -0
- package/augment-extensions/coding-standards/go/templates/prompts/distributed.md +133 -0
- package/augment-extensions/coding-standards/go/templates/prompts/microservices.md +225 -0
- package/augment-extensions/coding-standards/go/templates/prompts/web.md +181 -0
- package/augment-extensions/coding-standards/go/tests/integration/module-integration.test.ts +164 -0
- package/augment-extensions/coding-standards/go/tests/unit/category-selection.test.ts +147 -0
- package/augment-extensions/coding-standards/go/tests/unit/module-structure.test.ts +154 -0
- package/augment-extensions/coding-standards/go/tests/validate-character-count.ps1 +13 -0
- package/augment-extensions/coding-standards/go/tests/validate-examples.ps1 +148 -0
- package/augment-extensions/coding-standards/go/tests/validate-examples.sh +135 -0
- package/cli/dist/analysis/ast-parser.d.ts +47 -0
- package/cli/dist/analysis/ast-parser.d.ts.map +1 -0
- package/cli/dist/analysis/ast-parser.js +161 -0
- package/cli/dist/analysis/ast-parser.js.map +1 -0
- package/cli/dist/analysis/complexity-analyzer.d.ts +27 -0
- package/cli/dist/analysis/complexity-analyzer.d.ts.map +1 -0
- package/cli/dist/analysis/complexity-analyzer.js +189 -0
- package/cli/dist/analysis/complexity-analyzer.js.map +1 -0
- package/cli/dist/analysis/dependency-analyzer.d.ts +23 -0
- package/cli/dist/analysis/dependency-analyzer.d.ts.map +1 -0
- package/cli/dist/analysis/dependency-analyzer.js +237 -0
- package/cli/dist/analysis/dependency-analyzer.js.map +1 -0
- package/cli/dist/analysis/index.d.ts +9 -0
- package/cli/dist/analysis/index.d.ts.map +1 -0
- package/cli/dist/analysis/index.js +25 -0
- package/cli/dist/analysis/index.js.map +1 -0
- package/cli/dist/analysis/security-scanner.d.ts +11 -0
- package/cli/dist/analysis/security-scanner.d.ts.map +1 -0
- package/cli/dist/analysis/security-scanner.js +294 -0
- package/cli/dist/analysis/security-scanner.js.map +1 -0
- package/cli/dist/analysis/types.d.ts +151 -0
- package/cli/dist/analysis/types.d.ts.map +1 -0
- package/cli/dist/analysis/types.js +6 -0
- package/cli/dist/analysis/types.js.map +1 -0
- package/cli/dist/cli.js +24 -0
- package/cli/dist/cli.js.map +1 -1
- package/cli/dist/commands/code-analysis.d.ts +11 -0
- package/cli/dist/commands/code-analysis.d.ts.map +1 -0
- package/cli/dist/commands/code-analysis.js +412 -0
- package/cli/dist/commands/code-analysis.js.map +1 -0
- package/modules.md +99 -3
- package/package.json +14 -2
- package/cli/dist/commands/agent.d.ts +0 -37
- package/cli/dist/commands/agent.d.ts.map +0 -1
- package/cli/dist/commands/agent.js +0 -222
- package/cli/dist/commands/agent.js.map +0 -1
- package/cli/dist/commands/beads.d.ts +0 -64
- package/cli/dist/commands/beads.d.ts.map +0 -1
- package/cli/dist/commands/beads.js +0 -377
- package/cli/dist/commands/beads.js.map +0 -1
- package/cli/dist/commands/change.d.ts +0 -54
- package/cli/dist/commands/change.d.ts.map +0 -1
- package/cli/dist/commands/change.js +0 -243
- package/cli/dist/commands/change.js.map +0 -1
- package/cli/dist/commands/clean.d.ts +0 -15
- package/cli/dist/commands/clean.d.ts.map +0 -1
- package/cli/dist/commands/clean.js +0 -63
- package/cli/dist/commands/clean.js.map +0 -1
- package/cli/dist/commands/clone.d.ts +0 -15
- package/cli/dist/commands/clone.d.ts.map +0 -1
- package/cli/dist/commands/clone.js +0 -49
- package/cli/dist/commands/clone.js.map +0 -1
- package/cli/dist/commands/config.d.ts +0 -33
- package/cli/dist/commands/config.d.ts.map +0 -1
- package/cli/dist/commands/config.js +0 -166
- package/cli/dist/commands/config.js.map +0 -1
- package/cli/dist/commands/context.d.ts +0 -38
- package/cli/dist/commands/context.d.ts.map +0 -1
- package/cli/dist/commands/context.js +0 -205
- package/cli/dist/commands/context.js.map +0 -1
- package/cli/dist/commands/create.d.ts +0 -18
- package/cli/dist/commands/create.d.ts.map +0 -1
- package/cli/dist/commands/create.js +0 -178
- package/cli/dist/commands/create.js.map +0 -1
- package/cli/dist/commands/diff.d.ts +0 -19
- package/cli/dist/commands/diff.d.ts.map +0 -1
- package/cli/dist/commands/diff.js +0 -104
- package/cli/dist/commands/diff.js.map +0 -1
- package/cli/dist/commands/doctor.d.ts +0 -14
- package/cli/dist/commands/doctor.d.ts.map +0 -1
- package/cli/dist/commands/doctor.js +0 -62
- package/cli/dist/commands/doctor.js.map +0 -1
- package/cli/dist/commands/export.d.ts +0 -28
- package/cli/dist/commands/export.d.ts.map +0 -1
- package/cli/dist/commands/export.js +0 -135
- package/cli/dist/commands/export.js.map +0 -1
- package/cli/dist/commands/import.d.ts +0 -23
- package/cli/dist/commands/import.d.ts.map +0 -1
- package/cli/dist/commands/import.js +0 -118
- package/cli/dist/commands/import.js.map +0 -1
- package/cli/dist/commands/prompt.d.ts +0 -45
- package/cli/dist/commands/prompt.d.ts.map +0 -1
- package/cli/dist/commands/prompt.js +0 -223
- package/cli/dist/commands/prompt.js.map +0 -1
- package/cli/dist/commands/spec.d.ts +0 -57
- package/cli/dist/commands/spec.d.ts.map +0 -1
- package/cli/dist/commands/spec.js +0 -279
- package/cli/dist/commands/spec.js.map +0 -1
- package/cli/dist/commands/stats.d.ts +0 -18
- package/cli/dist/commands/stats.d.ts.map +0 -1
- package/cli/dist/commands/stats.js +0 -85
- package/cli/dist/commands/stats.js.map +0 -1
- package/cli/dist/commands/task.d.ts +0 -65
- package/cli/dist/commands/task.d.ts.map +0 -1
- package/cli/dist/commands/task.js +0 -282
- package/cli/dist/commands/task.js.map +0 -1
- package/cli/dist/commands/template.d.ts +0 -17
- package/cli/dist/commands/template.d.ts.map +0 -1
- package/cli/dist/commands/template.js +0 -55
- package/cli/dist/commands/template.js.map +0 -1
- package/cli/dist/utils/agent-config.d.ts +0 -129
- package/cli/dist/utils/agent-config.d.ts.map +0 -1
- package/cli/dist/utils/agent-config.js +0 -297
- package/cli/dist/utils/agent-config.js.map +0 -1
- package/cli/dist/utils/beads-graph.d.ts +0 -17
- package/cli/dist/utils/beads-graph.d.ts.map +0 -1
- package/cli/dist/utils/beads-graph.js +0 -150
- package/cli/dist/utils/beads-graph.js.map +0 -1
- package/cli/dist/utils/beads-integration.d.ts +0 -112
- package/cli/dist/utils/beads-integration.d.ts.map +0 -1
- package/cli/dist/utils/beads-integration.js +0 -312
- package/cli/dist/utils/beads-integration.js.map +0 -1
- package/cli/dist/utils/beads-reporter.d.ts +0 -17
- package/cli/dist/utils/beads-reporter.d.ts.map +0 -1
- package/cli/dist/utils/beads-reporter.js +0 -160
- package/cli/dist/utils/beads-reporter.js.map +0 -1
- package/cli/dist/utils/cache-manager.d.ts +0 -55
- package/cli/dist/utils/cache-manager.d.ts.map +0 -1
- package/cli/dist/utils/cache-manager.js +0 -150
- package/cli/dist/utils/cache-manager.js.map +0 -1
- package/cli/dist/utils/change-manager.d.ts +0 -70
- package/cli/dist/utils/change-manager.d.ts.map +0 -1
- package/cli/dist/utils/change-manager.js +0 -412
- package/cli/dist/utils/change-manager.js.map +0 -1
- package/cli/dist/utils/config-manager-enhanced.d.ts +0 -66
- package/cli/dist/utils/config-manager-enhanced.d.ts.map +0 -1
- package/cli/dist/utils/config-manager-enhanced.js +0 -77
- package/cli/dist/utils/config-manager-enhanced.js.map +0 -1
- package/cli/dist/utils/context-manager.d.ts +0 -96
- package/cli/dist/utils/context-manager.d.ts.map +0 -1
- package/cli/dist/utils/context-manager.js +0 -258
- package/cli/dist/utils/context-manager.js.map +0 -1
- package/cli/dist/utils/diff-engine.d.ts +0 -78
- package/cli/dist/utils/diff-engine.d.ts.map +0 -1
- package/cli/dist/utils/diff-engine.js +0 -233
- package/cli/dist/utils/diff-engine.js.map +0 -1
- package/cli/dist/utils/export-system.d.ts +0 -101
- package/cli/dist/utils/export-system.d.ts.map +0 -1
- package/cli/dist/utils/export-system.js +0 -289
- package/cli/dist/utils/export-system.js.map +0 -1
- package/cli/dist/utils/health-checker.d.ts +0 -66
- package/cli/dist/utils/health-checker.d.ts.map +0 -1
- package/cli/dist/utils/health-checker.js +0 -285
- package/cli/dist/utils/health-checker.js.map +0 -1
- package/cli/dist/utils/import-system.d.ts +0 -74
- package/cli/dist/utils/import-system.d.ts.map +0 -1
- package/cli/dist/utils/import-system.js +0 -317
- package/cli/dist/utils/import-system.js.map +0 -1
- package/cli/dist/utils/module-cloner.d.ts +0 -40
- package/cli/dist/utils/module-cloner.d.ts.map +0 -1
- package/cli/dist/utils/module-cloner.js +0 -136
- package/cli/dist/utils/module-cloner.js.map +0 -1
- package/cli/dist/utils/prompt-manager.d.ts +0 -90
- package/cli/dist/utils/prompt-manager.d.ts.map +0 -1
- package/cli/dist/utils/prompt-manager.js +0 -302
- package/cli/dist/utils/prompt-manager.js.map +0 -1
- package/cli/dist/utils/spec-manager.d.ts +0 -65
- package/cli/dist/utils/spec-manager.d.ts.map +0 -1
- package/cli/dist/utils/spec-manager.js +0 -329
- package/cli/dist/utils/spec-manager.js.map +0 -1
- package/cli/dist/utils/stats-collector.d.ts +0 -74
- package/cli/dist/utils/stats-collector.d.ts.map +0 -1
- package/cli/dist/utils/stats-collector.js +0 -164
- package/cli/dist/utils/stats-collector.js.map +0 -1
- package/cli/dist/utils/template-engine.d.ts +0 -47
- package/cli/dist/utils/template-engine.d.ts.map +0 -1
- package/cli/dist/utils/template-engine.js +0 -204
- package/cli/dist/utils/template-engine.js.map +0 -1
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file c89-to-c11-migration.c
|
|
3
|
+
* @brief Example demonstrating C89 to C11 migration patterns
|
|
4
|
+
*
|
|
5
|
+
* This file shows before/after examples of migrating legacy C89 code
|
|
6
|
+
* to modern C11 standards while maintaining compatibility.
|
|
7
|
+
*
|
|
8
|
+
* Compile C89: gcc -std=c89 -DUSE_C89 -o legacy c89-to-c11-migration.c
|
|
9
|
+
* Compile C11: gcc -std=c11 -o modern c89-to-c11-migration.c
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
#include <stdio.h>
|
|
13
|
+
#include <stdlib.h>
|
|
14
|
+
#include <string.h>
|
|
15
|
+
|
|
16
|
+
#ifdef USE_C89
|
|
17
|
+
/* C89 version */
|
|
18
|
+
|
|
19
|
+
#include <stddef.h>
|
|
20
|
+
|
|
21
|
+
/* C89: No inline keyword */
|
|
22
|
+
#define INLINE
|
|
23
|
+
|
|
24
|
+
/* C89: No bool type */
|
|
25
|
+
typedef int bool;
|
|
26
|
+
#define true 1
|
|
27
|
+
#define false 0
|
|
28
|
+
|
|
29
|
+
/* C89: No restrict keyword */
|
|
30
|
+
#define restrict
|
|
31
|
+
|
|
32
|
+
/* C89: No stdint.h */
|
|
33
|
+
typedef unsigned char uint8_t;
|
|
34
|
+
typedef unsigned short uint16_t;
|
|
35
|
+
typedef unsigned int uint32_t;
|
|
36
|
+
|
|
37
|
+
#else
|
|
38
|
+
/* C11 version */
|
|
39
|
+
|
|
40
|
+
#include <stdint.h>
|
|
41
|
+
#include <stdbool.h>
|
|
42
|
+
|
|
43
|
+
#define INLINE inline
|
|
44
|
+
|
|
45
|
+
#endif
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* EXAMPLE 1: Variable Declarations
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
void example_variable_declarations(void) {
|
|
52
|
+
#ifdef USE_C89
|
|
53
|
+
/* C89: All declarations at start of block */
|
|
54
|
+
int i;
|
|
55
|
+
int sum = 0;
|
|
56
|
+
int array[10];
|
|
57
|
+
|
|
58
|
+
/* Initialize array */
|
|
59
|
+
for (i = 0; i < 10; i++) {
|
|
60
|
+
array[i] = i;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Calculate sum */
|
|
64
|
+
for (i = 0; i < 10; i++) {
|
|
65
|
+
sum += array[i];
|
|
66
|
+
}
|
|
67
|
+
#else
|
|
68
|
+
/* C11: Declarations anywhere, loop variable in for() */
|
|
69
|
+
int sum = 0;
|
|
70
|
+
int array[10];
|
|
71
|
+
|
|
72
|
+
/* Initialize array */
|
|
73
|
+
for (int i = 0; i < 10; i++) {
|
|
74
|
+
array[i] = i;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Calculate sum - can reuse 'i' */
|
|
78
|
+
for (int i = 0; i < 10; i++) {
|
|
79
|
+
sum += array[i];
|
|
80
|
+
}
|
|
81
|
+
#endif
|
|
82
|
+
|
|
83
|
+
printf("Sum: %d\n", sum);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* EXAMPLE 2: Designated Initializers
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
typedef struct {
|
|
91
|
+
int x;
|
|
92
|
+
int y;
|
|
93
|
+
int z;
|
|
94
|
+
} Point3D;
|
|
95
|
+
|
|
96
|
+
void example_designated_initializers(void) {
|
|
97
|
+
#ifdef USE_C89
|
|
98
|
+
/* C89: Positional initialization only */
|
|
99
|
+
Point3D p1;
|
|
100
|
+
p1.x = 10;
|
|
101
|
+
p1.y = 20;
|
|
102
|
+
p1.z = 30;
|
|
103
|
+
|
|
104
|
+
/* Or with initializer list (must be in order) */
|
|
105
|
+
Point3D p2 = {10, 20, 30};
|
|
106
|
+
#else
|
|
107
|
+
/* C11: Designated initializers (any order) */
|
|
108
|
+
Point3D p1 = {.x = 10, .y = 20, .z = 30};
|
|
109
|
+
Point3D p2 = {.z = 30, .x = 10, .y = 20}; /* Order doesn't matter */
|
|
110
|
+
Point3D p3 = {.x = 10}; /* Others default to 0 */
|
|
111
|
+
#endif
|
|
112
|
+
|
|
113
|
+
printf("Point: (%d, %d, %d)\n", p1.x, p1.y, p1.z);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* EXAMPLE 3: Static Assertions
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
void example_static_assertions(void) {
|
|
121
|
+
#ifdef USE_C89
|
|
122
|
+
/* C89: Runtime assertion only */
|
|
123
|
+
if (sizeof(int) != 4) {
|
|
124
|
+
fprintf(stderr, "Error: int is not 4 bytes\n");
|
|
125
|
+
exit(1);
|
|
126
|
+
}
|
|
127
|
+
#else
|
|
128
|
+
/* C11: Compile-time assertion */
|
|
129
|
+
_Static_assert(sizeof(int) == 4, "int must be 4 bytes");
|
|
130
|
+
#endif
|
|
131
|
+
|
|
132
|
+
printf("Size checks passed\n");
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* EXAMPLE 4: Flexible Array Members
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
#ifdef USE_C89
|
|
140
|
+
/* C89: Use array of size 1 (hack) */
|
|
141
|
+
typedef struct {
|
|
142
|
+
size_t length;
|
|
143
|
+
char data[1]; /* Actually variable length */
|
|
144
|
+
} Buffer_C89;
|
|
145
|
+
|
|
146
|
+
Buffer_C89* create_buffer_c89(size_t size) {
|
|
147
|
+
Buffer_C89 *buf = malloc(sizeof(Buffer_C89) + size - 1);
|
|
148
|
+
if (buf) {
|
|
149
|
+
buf->length = size;
|
|
150
|
+
}
|
|
151
|
+
return buf;
|
|
152
|
+
}
|
|
153
|
+
#else
|
|
154
|
+
/* C11: Flexible array member */
|
|
155
|
+
typedef struct {
|
|
156
|
+
size_t length;
|
|
157
|
+
char data[]; /* Flexible array member */
|
|
158
|
+
} Buffer_C11;
|
|
159
|
+
|
|
160
|
+
Buffer_C11* create_buffer_c11(size_t size) {
|
|
161
|
+
Buffer_C11 *buf = malloc(sizeof(Buffer_C11) + size);
|
|
162
|
+
if (buf) {
|
|
163
|
+
buf->length = size;
|
|
164
|
+
}
|
|
165
|
+
return buf;
|
|
166
|
+
}
|
|
167
|
+
#endif
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* EXAMPLE 5: Inline Functions
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
/* C89: Use macro (no type safety) */
|
|
174
|
+
#ifdef USE_C89
|
|
175
|
+
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
|
176
|
+
#else
|
|
177
|
+
/* C11: Inline function (type safe) */
|
|
178
|
+
static inline int max_int(int a, int b) {
|
|
179
|
+
return a > b ? a : b;
|
|
180
|
+
}
|
|
181
|
+
#endif
|
|
182
|
+
|
|
183
|
+
void example_inline_functions(void) {
|
|
184
|
+
#ifdef USE_C89
|
|
185
|
+
int result = MAX(10, 20);
|
|
186
|
+
#else
|
|
187
|
+
int result = max_int(10, 20);
|
|
188
|
+
#endif
|
|
189
|
+
printf("Max: %d\n", result);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* EXAMPLE 6: Anonymous Unions/Structs
|
|
194
|
+
*/
|
|
195
|
+
|
|
196
|
+
#ifdef USE_C89
|
|
197
|
+
/* C89: Named union required */
|
|
198
|
+
typedef struct {
|
|
199
|
+
int type;
|
|
200
|
+
union {
|
|
201
|
+
int i;
|
|
202
|
+
float f;
|
|
203
|
+
} value; /* Must be named */
|
|
204
|
+
} Variant_C89;
|
|
205
|
+
|
|
206
|
+
void use_variant_c89(void) {
|
|
207
|
+
Variant_C89 v;
|
|
208
|
+
v.type = 1;
|
|
209
|
+
v.value.i = 42; /* Must use union name */
|
|
210
|
+
printf("Value: %d\n", v.value.i);
|
|
211
|
+
}
|
|
212
|
+
#else
|
|
213
|
+
/* C11: Anonymous union */
|
|
214
|
+
typedef struct {
|
|
215
|
+
int type;
|
|
216
|
+
union {
|
|
217
|
+
int i;
|
|
218
|
+
float f;
|
|
219
|
+
}; /* Anonymous */
|
|
220
|
+
} Variant_C11;
|
|
221
|
+
|
|
222
|
+
void use_variant_c11(void) {
|
|
223
|
+
Variant_C11 v;
|
|
224
|
+
v.type = 1;
|
|
225
|
+
v.i = 42; /* Direct access */
|
|
226
|
+
printf("Value: %d\n", v.i);
|
|
227
|
+
}
|
|
228
|
+
#endif
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Main function
|
|
232
|
+
*/
|
|
233
|
+
int main(void) {
|
|
234
|
+
printf("=== C89 to C11 Migration Examples ===\n\n");
|
|
235
|
+
|
|
236
|
+
#ifdef USE_C89
|
|
237
|
+
printf("Compiled with C89 standard\n\n");
|
|
238
|
+
#else
|
|
239
|
+
printf("Compiled with C11 standard\n\n");
|
|
240
|
+
#endif
|
|
241
|
+
|
|
242
|
+
printf("Example 1: Variable Declarations\n");
|
|
243
|
+
example_variable_declarations();
|
|
244
|
+
printf("\n");
|
|
245
|
+
|
|
246
|
+
printf("Example 2: Designated Initializers\n");
|
|
247
|
+
example_designated_initializers();
|
|
248
|
+
printf("\n");
|
|
249
|
+
|
|
250
|
+
printf("Example 3: Static Assertions\n");
|
|
251
|
+
example_static_assertions();
|
|
252
|
+
printf("\n");
|
|
253
|
+
|
|
254
|
+
printf("Example 5: Inline Functions\n");
|
|
255
|
+
example_inline_functions();
|
|
256
|
+
printf("\n");
|
|
257
|
+
|
|
258
|
+
#ifdef USE_C89
|
|
259
|
+
printf("Example 6: Anonymous Unions (C89)\n");
|
|
260
|
+
use_variant_c89();
|
|
261
|
+
#else
|
|
262
|
+
printf("Example 6: Anonymous Unions (C11)\n");
|
|
263
|
+
use_variant_c11();
|
|
264
|
+
#endif
|
|
265
|
+
|
|
266
|
+
return 0;
|
|
267
|
+
}
|
|
268
|
+
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file compatibility-layer.c
|
|
3
|
+
* @brief Example compatibility layer for cross-platform and cross-standard code
|
|
4
|
+
*
|
|
5
|
+
* This example demonstrates:
|
|
6
|
+
* - Platform abstraction
|
|
7
|
+
* - C standard compatibility
|
|
8
|
+
* - Compiler-specific workarounds
|
|
9
|
+
* - Feature detection
|
|
10
|
+
* - Graceful degradation
|
|
11
|
+
*
|
|
12
|
+
* Compile: gcc -Wall -Wextra -std=c11 -o compat compatibility-layer.c
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
#include <stdio.h>
|
|
16
|
+
#include <stdlib.h>
|
|
17
|
+
#include <string.h>
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* SECTION 1: Compiler Detection
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
#if defined(__GNUC__)
|
|
24
|
+
#define COMPILER_GCC 1
|
|
25
|
+
#define COMPILER_NAME "GCC"
|
|
26
|
+
#elif defined(_MSC_VER)
|
|
27
|
+
#define COMPILER_MSVC 1
|
|
28
|
+
#define COMPILER_NAME "MSVC"
|
|
29
|
+
#elif defined(__clang__)
|
|
30
|
+
#define COMPILER_CLANG 1
|
|
31
|
+
#define COMPILER_NAME "Clang"
|
|
32
|
+
#else
|
|
33
|
+
#define COMPILER_UNKNOWN 1
|
|
34
|
+
#define COMPILER_NAME "Unknown"
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* SECTION 2: Platform Detection
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
#if defined(_WIN32) || defined(_WIN64)
|
|
42
|
+
#define PLATFORM_WINDOWS 1
|
|
43
|
+
#define PLATFORM_NAME "Windows"
|
|
44
|
+
#elif defined(__linux__)
|
|
45
|
+
#define PLATFORM_LINUX 1
|
|
46
|
+
#define PLATFORM_NAME "Linux"
|
|
47
|
+
#elif defined(__APPLE__)
|
|
48
|
+
#define PLATFORM_MACOS 1
|
|
49
|
+
#define PLATFORM_NAME "macOS"
|
|
50
|
+
#else
|
|
51
|
+
#define PLATFORM_UNKNOWN 1
|
|
52
|
+
#define PLATFORM_NAME "Unknown"
|
|
53
|
+
#endif
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* SECTION 3: C Standard Detection
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
#if __STDC_VERSION__ >= 201112L
|
|
60
|
+
#define C_STANDARD_C11 1
|
|
61
|
+
#define C_STANDARD_NAME "C11"
|
|
62
|
+
#elif __STDC_VERSION__ >= 199901L
|
|
63
|
+
#define C_STANDARD_C99 1
|
|
64
|
+
#define C_STANDARD_NAME "C99"
|
|
65
|
+
#else
|
|
66
|
+
#define C_STANDARD_C89 1
|
|
67
|
+
#define C_STANDARD_NAME "C89"
|
|
68
|
+
#endif
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* SECTION 4: Feature Compatibility Macros
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
/* Inline keyword */
|
|
75
|
+
#if defined(C_STANDARD_C99) || defined(C_STANDARD_C11)
|
|
76
|
+
#define COMPAT_INLINE inline
|
|
77
|
+
#elif defined(COMPILER_GCC) || defined(COMPILER_CLANG)
|
|
78
|
+
#define COMPAT_INLINE __inline__
|
|
79
|
+
#elif defined(COMPILER_MSVC)
|
|
80
|
+
#define COMPAT_INLINE __inline
|
|
81
|
+
#else
|
|
82
|
+
#define COMPAT_INLINE
|
|
83
|
+
#endif
|
|
84
|
+
|
|
85
|
+
/* Restrict keyword */
|
|
86
|
+
#if defined(C_STANDARD_C99) || defined(C_STANDARD_C11)
|
|
87
|
+
#define COMPAT_RESTRICT restrict
|
|
88
|
+
#elif defined(COMPILER_GCC) || defined(COMPILER_CLANG)
|
|
89
|
+
#define COMPAT_RESTRICT __restrict__
|
|
90
|
+
#elif defined(COMPILER_MSVC)
|
|
91
|
+
#define COMPAT_RESTRICT __restrict
|
|
92
|
+
#else
|
|
93
|
+
#define COMPAT_RESTRICT
|
|
94
|
+
#endif
|
|
95
|
+
|
|
96
|
+
/* Function attributes */
|
|
97
|
+
#if defined(COMPILER_GCC) || defined(COMPILER_CLANG)
|
|
98
|
+
#define COMPAT_NORETURN __attribute__((noreturn))
|
|
99
|
+
#define COMPAT_UNUSED __attribute__((unused))
|
|
100
|
+
#define COMPAT_PRINTF_FORMAT(fmt, args) __attribute__((format(printf, fmt, args)))
|
|
101
|
+
#elif defined(COMPILER_MSVC)
|
|
102
|
+
#define COMPAT_NORETURN __declspec(noreturn)
|
|
103
|
+
#define COMPAT_UNUSED
|
|
104
|
+
#define COMPAT_PRINTF_FORMAT(fmt, args)
|
|
105
|
+
#else
|
|
106
|
+
#define COMPAT_NORETURN
|
|
107
|
+
#define COMPAT_UNUSED
|
|
108
|
+
#define COMPAT_PRINTF_FORMAT(fmt, args)
|
|
109
|
+
#endif
|
|
110
|
+
|
|
111
|
+
/* Static assertion */
|
|
112
|
+
#if defined(C_STANDARD_C11)
|
|
113
|
+
#define COMPAT_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
|
|
114
|
+
#elif defined(COMPILER_GCC) && __GNUC__ >= 4
|
|
115
|
+
#define COMPAT_STATIC_ASSERT(cond, msg) \
|
|
116
|
+
typedef char static_assertion_##__LINE__[(cond) ? 1 : -1]
|
|
117
|
+
#else
|
|
118
|
+
#define COMPAT_STATIC_ASSERT(cond, msg)
|
|
119
|
+
#endif
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* SECTION 5: Type Compatibility
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
#if defined(C_STANDARD_C99) || defined(C_STANDARD_C11)
|
|
126
|
+
#include <stdint.h>
|
|
127
|
+
#include <stdbool.h>
|
|
128
|
+
#else
|
|
129
|
+
/* Provide stdint types for C89 */
|
|
130
|
+
typedef unsigned char uint8_t;
|
|
131
|
+
typedef unsigned short uint16_t;
|
|
132
|
+
typedef unsigned int uint32_t;
|
|
133
|
+
typedef signed char int8_t;
|
|
134
|
+
typedef short int16_t;
|
|
135
|
+
typedef int int32_t;
|
|
136
|
+
|
|
137
|
+
/* Provide bool for C89 */
|
|
138
|
+
typedef int bool;
|
|
139
|
+
#define true 1
|
|
140
|
+
#define false 0
|
|
141
|
+
#endif
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* SECTION 6: Platform-Specific Functions
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
#ifdef PLATFORM_WINDOWS
|
|
148
|
+
#include <windows.h>
|
|
149
|
+
|
|
150
|
+
static COMPAT_INLINE void compat_sleep_ms(unsigned int ms) {
|
|
151
|
+
Sleep(ms);
|
|
152
|
+
}
|
|
153
|
+
#else
|
|
154
|
+
#include <unistd.h>
|
|
155
|
+
|
|
156
|
+
static COMPAT_INLINE void compat_sleep_ms(unsigned int ms) {
|
|
157
|
+
usleep(ms * 1000);
|
|
158
|
+
}
|
|
159
|
+
#endif
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* SECTION 7: Safe String Functions
|
|
163
|
+
*/
|
|
164
|
+
|
|
165
|
+
/* Safe string copy (compatible with all platforms) */
|
|
166
|
+
static COMPAT_INLINE size_t compat_strlcpy(char *dst, const char *src, size_t size) {
|
|
167
|
+
size_t src_len = strlen(src);
|
|
168
|
+
|
|
169
|
+
if (size > 0) {
|
|
170
|
+
size_t copy_len = (src_len >= size) ? size - 1 : src_len;
|
|
171
|
+
memcpy(dst, src, copy_len);
|
|
172
|
+
dst[copy_len] = '\0';
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return src_len;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* SECTION 8: Example Usage
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
/* Example function with compatibility features */
|
|
183
|
+
static COMPAT_INLINE int compat_add(int a, int b) {
|
|
184
|
+
return a + b;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* Example function with printf format checking */
|
|
188
|
+
static void COMPAT_PRINTF_FORMAT(1, 2) compat_log(const char *format, ...) {
|
|
189
|
+
va_list args;
|
|
190
|
+
va_start(args, format);
|
|
191
|
+
vprintf(format, args);
|
|
192
|
+
va_end(args);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* Example noreturn function */
|
|
196
|
+
static COMPAT_NORETURN void compat_fatal_error(const char *msg) {
|
|
197
|
+
fprintf(stderr, "FATAL ERROR: %s\n", msg);
|
|
198
|
+
exit(EXIT_FAILURE);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* SECTION 9: Compile-Time Checks
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
/* Verify type sizes */
|
|
206
|
+
COMPAT_STATIC_ASSERT(sizeof(uint8_t) == 1, "uint8_t must be 1 byte");
|
|
207
|
+
COMPAT_STATIC_ASSERT(sizeof(uint16_t) == 2, "uint16_t must be 2 bytes");
|
|
208
|
+
COMPAT_STATIC_ASSERT(sizeof(uint32_t) == 4, "uint32_t must be 4 bytes");
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Main function
|
|
212
|
+
*/
|
|
213
|
+
int main(void) {
|
|
214
|
+
printf("=== Compatibility Layer Example ===\n\n");
|
|
215
|
+
|
|
216
|
+
printf("Compiler: %s\n", COMPILER_NAME);
|
|
217
|
+
printf("Platform: %s\n", PLATFORM_NAME);
|
|
218
|
+
printf("C Standard: %s\n", C_STANDARD_NAME);
|
|
219
|
+
printf("\n");
|
|
220
|
+
|
|
221
|
+
/* Test compatibility functions */
|
|
222
|
+
printf("Testing compat_add: %d\n", compat_add(10, 20));
|
|
223
|
+
|
|
224
|
+
/* Test safe string copy */
|
|
225
|
+
char buffer[10];
|
|
226
|
+
compat_strlcpy(buffer, "Hello, World!", sizeof(buffer));
|
|
227
|
+
printf("Truncated string: %s\n", buffer);
|
|
228
|
+
|
|
229
|
+
/* Test platform sleep */
|
|
230
|
+
printf("Sleeping for 100ms...\n");
|
|
231
|
+
compat_sleep_ms(100);
|
|
232
|
+
printf("Done!\n");
|
|
233
|
+
|
|
234
|
+
/* Test logging */
|
|
235
|
+
compat_log("Log message: %d + %d = %d\n", 5, 3, 5 + 3);
|
|
236
|
+
|
|
237
|
+
return EXIT_SUCCESS;
|
|
238
|
+
}
|
|
239
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Makefile for Networking Examples
|
|
2
|
+
|
|
3
|
+
CC = gcc
|
|
4
|
+
CFLAGS = -Wall -Wextra -Werror -std=c11 -pedantic -O2
|
|
5
|
+
LDFLAGS =
|
|
6
|
+
TARGETS = tcp-server udp-multicast protocol-parser
|
|
7
|
+
|
|
8
|
+
.PHONY: all clean test
|
|
9
|
+
|
|
10
|
+
all: $(TARGETS)
|
|
11
|
+
|
|
12
|
+
tcp-server: tcp-server.c
|
|
13
|
+
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
|
|
14
|
+
|
|
15
|
+
udp-multicast: udp-multicast.c
|
|
16
|
+
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
|
|
17
|
+
|
|
18
|
+
protocol-parser: protocol-parser.c
|
|
19
|
+
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
|
|
20
|
+
|
|
21
|
+
clean:
|
|
22
|
+
rm -f $(TARGETS) *.o
|
|
23
|
+
|
|
24
|
+
test: all
|
|
25
|
+
@echo "Testing protocol parser..."
|
|
26
|
+
./protocol-parser
|
|
27
|
+
@echo ""
|
|
28
|
+
@echo "To test TCP server:"
|
|
29
|
+
@echo " Terminal 1: ./tcp-server 8080"
|
|
30
|
+
@echo " Terminal 2: telnet localhost 8080"
|
|
31
|
+
@echo ""
|
|
32
|
+
@echo "To test UDP multicast:"
|
|
33
|
+
@echo " Terminal 1: ./udp-multicast recv 239.0.0.1 5000"
|
|
34
|
+
@echo " Terminal 2: ./udp-multicast send 239.0.0.1 5000"
|
|
35
|
+
|