feat(CS-2124): finish Assignment 1
@ -1,6 +1,6 @@
|
||||
#+FILETAGS: :college:cs1011:
|
||||
** TODO Group Project
|
||||
SCHEDULED: <2024-01-22 Mon> DEADLINE: <2024-02-02 Fri>
|
||||
SCHEDULED: <2024-01-28 Sun> DEADLINE: <2024-02-02 Fri>
|
||||
|
||||
- Sign up for a Group under the =People= tab in Canvas
|
||||
- Due in 2 weeks from today
|
||||
|
225
Spring-2023/CS-2124/Assignment-1/.clang-format
Normal file
@ -0,0 +1,225 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignArrayOfStructures: None
|
||||
AlignConsecutiveAssignments:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: true
|
||||
AlignConsecutiveBitFields:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveDeclarations:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveMacros:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments:
|
||||
Kind: Always
|
||||
OverEmptyLines: 0
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortEnumsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
AttributeMacros:
|
||||
- __capability
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BitFieldColonSpacing: Both
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterExternBlock: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakAfterAttributes: Never
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakArrays: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeConceptDeclarations: Always
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInlineASMColon: OnlyMultiline
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IfMacros:
|
||||
- KJ_IF_MAYBE
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseBlocks: false
|
||||
IndentCaseLabels: false
|
||||
IndentExternBlock: AfterExternBlock
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentRequiresClause: true
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertBraces: false
|
||||
InsertNewlineAtEOF: false
|
||||
InsertTrailingCommas: None
|
||||
IntegerLiteralSeparator:
|
||||
Binary: 0
|
||||
BinaryMinDigits: 0
|
||||
Decimal: 0
|
||||
DecimalMinDigits: 0
|
||||
Hex: 0
|
||||
HexMinDigits: 0
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
LambdaBodyIndentation: Signature
|
||||
LineEnding: DeriveLF
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PackConstructorInitializers: BinPack
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakOpenParenthesis: 0
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyIndentedWhitespace: 0
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Right
|
||||
PPIndentWidth: -1
|
||||
QualifierAlignment: Leave
|
||||
ReferenceAlignment: Pointer
|
||||
ReflowComments: true
|
||||
RemoveBracesLLVM: false
|
||||
RemoveSemicolon: false
|
||||
RequiresClausePosition: OwnLine
|
||||
RequiresExpressionIndentation: OuterScope
|
||||
SeparateDefinitionBlocks: Leave
|
||||
ShortNamespaceLines: 1
|
||||
SortIncludes: CaseSensitive
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: LexicographicNumeric
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeParensOptions:
|
||||
AfterControlStatements: true
|
||||
AfterForeachMacros: true
|
||||
AfterFunctionDefinitionName: false
|
||||
AfterFunctionDeclarationName: false
|
||||
AfterIfMacros: true
|
||||
AfterOverloadedOperator: false
|
||||
AfterRequiresInClause: false
|
||||
AfterRequiresInExpression: false
|
||||
BeforeNonEmptyParentheses: false
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: Never
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 1
|
||||
Maximum: -1
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Latest
|
||||
StatementAttributeLikeMacros:
|
||||
- Q_EMIT
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros:
|
||||
- BOOST_PP_STRINGIZE
|
||||
- CF_SWIFT_NAME
|
||||
- NS_SWIFT_NAME
|
||||
- PP_STRINGIZE
|
||||
- STRINGIZE
|
||||
...
|
||||
|
5
Spring-2023/CS-2124/Assignment-1/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
bin
|
||||
CMakeFiles
|
||||
CMakeCache.txt
|
||||
cmake_install.cmake
|
||||
README.pdf
|
@ -1,13 +1,31 @@
|
||||
cmake_minimum_required(VERSION 3.25)
|
||||
|
||||
project(dynamic-memory LANGUAGES "C")
|
||||
file(GLOB_RECURSE dynamic-memory-sources CONFIGURE_DEPENDS "progs/dynamic-memory/src/*.c" "progs/dynamic-memory/src/*.h")
|
||||
add_executable(dynamic-memory ${dynamic-memory-sources})
|
||||
set(SOURCES src/src.h src/src.c src/lib/lib.h src/lib/lib.c)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
|
||||
|
||||
project(file-operations LANGUAGES "C")
|
||||
file(GLOB_RECURSE file-operations-sources CONFIGURE_DEPENDS "progs/file-operations/src/*.c" "progs/file-operations/src/*.h")
|
||||
add_executable(file-operations ${file-operations-sources})
|
||||
|
||||
project(string-manipulation LANGUAGES "C")
|
||||
file(GLOB_RECURSE string-manipulation-sources CONFIGURE_DEPENDS "progs/string-manipulation/src/*.c" "progs/string-manipulation/src/*.h")
|
||||
add_executable(string-manipulation ${string-manipulation-sources})
|
||||
project(AssignmentOne LANGUAGES C)
|
||||
|
||||
add_executable(C1 src/C1.c ${SOURCES})
|
||||
|
||||
add_executable(C2 src/C2.c ${SOURCES})
|
||||
|
||||
add_executable(C3 src/C3.c ${SOURCES})
|
||||
|
||||
add_executable(C4 src/C4.c ${SOURCES})
|
||||
|
||||
add_executable(C5 src/C5.c ${SOURCES})
|
||||
|
||||
add_executable(C6 src/C6.c ${SOURCES})
|
||||
|
||||
add_executable(C7 src/C7.c ${SOURCES})
|
||||
|
||||
add_executable(C8 src/C8.c ${SOURCES})
|
||||
|
||||
add_executable(C9 src/C9.c ${SOURCES})
|
||||
|
||||
add_executable(C10 src/C10.c ${SOURCES})
|
||||
|
||||
add_executable(C11 src/C11.c ${SOURCES})
|
||||
|
||||
add_executable(C12 src/C12.c ${SOURCES})
|
||||
|
@ -113,120 +113,566 @@ preinstall/fast:
|
||||
|
||||
# clear depends
|
||||
depend:
|
||||
$(CMAKE_COMMAND) -P /home/sam/Git/College/Spring-2023/CS-2124/Assignment-1/CMakeFiles/VerifyGlobs.cmake
|
||||
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
|
||||
.PHONY : depend
|
||||
|
||||
#=============================================================================
|
||||
# Target rules for targets named dynamic-memory
|
||||
# Target rules for targets named C1
|
||||
|
||||
# Build rule for target.
|
||||
dynamic-memory: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 dynamic-memory
|
||||
.PHONY : dynamic-memory
|
||||
C1: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 C1
|
||||
.PHONY : C1
|
||||
|
||||
# fast build rule for target.
|
||||
dynamic-memory/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/dynamic-memory.dir/build.make CMakeFiles/dynamic-memory.dir/build
|
||||
.PHONY : dynamic-memory/fast
|
||||
C1/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C1.dir/build.make CMakeFiles/C1.dir/build
|
||||
.PHONY : C1/fast
|
||||
|
||||
#=============================================================================
|
||||
# Target rules for targets named file-operations
|
||||
# Target rules for targets named C2
|
||||
|
||||
# Build rule for target.
|
||||
file-operations: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 file-operations
|
||||
.PHONY : file-operations
|
||||
C2: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 C2
|
||||
.PHONY : C2
|
||||
|
||||
# fast build rule for target.
|
||||
file-operations/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/file-operations.dir/build.make CMakeFiles/file-operations.dir/build
|
||||
.PHONY : file-operations/fast
|
||||
C2/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C2.dir/build.make CMakeFiles/C2.dir/build
|
||||
.PHONY : C2/fast
|
||||
|
||||
#=============================================================================
|
||||
# Target rules for targets named string-manipulation
|
||||
# Target rules for targets named C3
|
||||
|
||||
# Build rule for target.
|
||||
string-manipulation: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 string-manipulation
|
||||
.PHONY : string-manipulation
|
||||
C3: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 C3
|
||||
.PHONY : C3
|
||||
|
||||
# fast build rule for target.
|
||||
string-manipulation/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/string-manipulation.dir/build.make CMakeFiles/string-manipulation.dir/build
|
||||
.PHONY : string-manipulation/fast
|
||||
C3/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C3.dir/build.make CMakeFiles/C3.dir/build
|
||||
.PHONY : C3/fast
|
||||
|
||||
progs/dynamic-memory/src/main.o: progs/dynamic-memory/src/main.c.o
|
||||
.PHONY : progs/dynamic-memory/src/main.o
|
||||
#=============================================================================
|
||||
# Target rules for targets named C4
|
||||
|
||||
# Build rule for target.
|
||||
C4: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 C4
|
||||
.PHONY : C4
|
||||
|
||||
# fast build rule for target.
|
||||
C4/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C4.dir/build.make CMakeFiles/C4.dir/build
|
||||
.PHONY : C4/fast
|
||||
|
||||
#=============================================================================
|
||||
# Target rules for targets named C5
|
||||
|
||||
# Build rule for target.
|
||||
C5: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 C5
|
||||
.PHONY : C5
|
||||
|
||||
# fast build rule for target.
|
||||
C5/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C5.dir/build.make CMakeFiles/C5.dir/build
|
||||
.PHONY : C5/fast
|
||||
|
||||
#=============================================================================
|
||||
# Target rules for targets named C6
|
||||
|
||||
# Build rule for target.
|
||||
C6: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 C6
|
||||
.PHONY : C6
|
||||
|
||||
# fast build rule for target.
|
||||
C6/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C6.dir/build.make CMakeFiles/C6.dir/build
|
||||
.PHONY : C6/fast
|
||||
|
||||
#=============================================================================
|
||||
# Target rules for targets named C7
|
||||
|
||||
# Build rule for target.
|
||||
C7: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 C7
|
||||
.PHONY : C7
|
||||
|
||||
# fast build rule for target.
|
||||
C7/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C7.dir/build.make CMakeFiles/C7.dir/build
|
||||
.PHONY : C7/fast
|
||||
|
||||
#=============================================================================
|
||||
# Target rules for targets named C8
|
||||
|
||||
# Build rule for target.
|
||||
C8: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 C8
|
||||
.PHONY : C8
|
||||
|
||||
# fast build rule for target.
|
||||
C8/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C8.dir/build.make CMakeFiles/C8.dir/build
|
||||
.PHONY : C8/fast
|
||||
|
||||
#=============================================================================
|
||||
# Target rules for targets named C9
|
||||
|
||||
# Build rule for target.
|
||||
C9: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 C9
|
||||
.PHONY : C9
|
||||
|
||||
# fast build rule for target.
|
||||
C9/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C9.dir/build.make CMakeFiles/C9.dir/build
|
||||
.PHONY : C9/fast
|
||||
|
||||
#=============================================================================
|
||||
# Target rules for targets named C10
|
||||
|
||||
# Build rule for target.
|
||||
C10: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 C10
|
||||
.PHONY : C10
|
||||
|
||||
# fast build rule for target.
|
||||
C10/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C10.dir/build.make CMakeFiles/C10.dir/build
|
||||
.PHONY : C10/fast
|
||||
|
||||
#=============================================================================
|
||||
# Target rules for targets named C11
|
||||
|
||||
# Build rule for target.
|
||||
C11: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 C11
|
||||
.PHONY : C11
|
||||
|
||||
# fast build rule for target.
|
||||
C11/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C11.dir/build.make CMakeFiles/C11.dir/build
|
||||
.PHONY : C11/fast
|
||||
|
||||
#=============================================================================
|
||||
# Target rules for targets named C12
|
||||
|
||||
# Build rule for target.
|
||||
C12: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 C12
|
||||
.PHONY : C12
|
||||
|
||||
# fast build rule for target.
|
||||
C12/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C12.dir/build.make CMakeFiles/C12.dir/build
|
||||
.PHONY : C12/fast
|
||||
|
||||
src/C1.o: src/C1.c.o
|
||||
.PHONY : src/C1.o
|
||||
|
||||
# target to build an object file
|
||||
progs/dynamic-memory/src/main.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/dynamic-memory.dir/build.make CMakeFiles/dynamic-memory.dir/progs/dynamic-memory/src/main.c.o
|
||||
.PHONY : progs/dynamic-memory/src/main.c.o
|
||||
src/C1.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C1.dir/build.make CMakeFiles/C1.dir/src/C1.c.o
|
||||
.PHONY : src/C1.c.o
|
||||
|
||||
progs/dynamic-memory/src/main.i: progs/dynamic-memory/src/main.c.i
|
||||
.PHONY : progs/dynamic-memory/src/main.i
|
||||
src/C1.i: src/C1.c.i
|
||||
.PHONY : src/C1.i
|
||||
|
||||
# target to preprocess a source file
|
||||
progs/dynamic-memory/src/main.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/dynamic-memory.dir/build.make CMakeFiles/dynamic-memory.dir/progs/dynamic-memory/src/main.c.i
|
||||
.PHONY : progs/dynamic-memory/src/main.c.i
|
||||
src/C1.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C1.dir/build.make CMakeFiles/C1.dir/src/C1.c.i
|
||||
.PHONY : src/C1.c.i
|
||||
|
||||
progs/dynamic-memory/src/main.s: progs/dynamic-memory/src/main.c.s
|
||||
.PHONY : progs/dynamic-memory/src/main.s
|
||||
src/C1.s: src/C1.c.s
|
||||
.PHONY : src/C1.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
progs/dynamic-memory/src/main.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/dynamic-memory.dir/build.make CMakeFiles/dynamic-memory.dir/progs/dynamic-memory/src/main.c.s
|
||||
.PHONY : progs/dynamic-memory/src/main.c.s
|
||||
src/C1.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C1.dir/build.make CMakeFiles/C1.dir/src/C1.c.s
|
||||
.PHONY : src/C1.c.s
|
||||
|
||||
progs/file-operations/src/main.o: progs/file-operations/src/main.c.o
|
||||
.PHONY : progs/file-operations/src/main.o
|
||||
src/C10.o: src/C10.c.o
|
||||
.PHONY : src/C10.o
|
||||
|
||||
# target to build an object file
|
||||
progs/file-operations/src/main.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/file-operations.dir/build.make CMakeFiles/file-operations.dir/progs/file-operations/src/main.c.o
|
||||
.PHONY : progs/file-operations/src/main.c.o
|
||||
src/C10.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C10.dir/build.make CMakeFiles/C10.dir/src/C10.c.o
|
||||
.PHONY : src/C10.c.o
|
||||
|
||||
progs/file-operations/src/main.i: progs/file-operations/src/main.c.i
|
||||
.PHONY : progs/file-operations/src/main.i
|
||||
src/C10.i: src/C10.c.i
|
||||
.PHONY : src/C10.i
|
||||
|
||||
# target to preprocess a source file
|
||||
progs/file-operations/src/main.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/file-operations.dir/build.make CMakeFiles/file-operations.dir/progs/file-operations/src/main.c.i
|
||||
.PHONY : progs/file-operations/src/main.c.i
|
||||
src/C10.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C10.dir/build.make CMakeFiles/C10.dir/src/C10.c.i
|
||||
.PHONY : src/C10.c.i
|
||||
|
||||
progs/file-operations/src/main.s: progs/file-operations/src/main.c.s
|
||||
.PHONY : progs/file-operations/src/main.s
|
||||
src/C10.s: src/C10.c.s
|
||||
.PHONY : src/C10.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
progs/file-operations/src/main.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/file-operations.dir/build.make CMakeFiles/file-operations.dir/progs/file-operations/src/main.c.s
|
||||
.PHONY : progs/file-operations/src/main.c.s
|
||||
src/C10.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C10.dir/build.make CMakeFiles/C10.dir/src/C10.c.s
|
||||
.PHONY : src/C10.c.s
|
||||
|
||||
progs/string-manipulation/src/main.o: progs/string-manipulation/src/main.c.o
|
||||
.PHONY : progs/string-manipulation/src/main.o
|
||||
src/C11.o: src/C11.c.o
|
||||
.PHONY : src/C11.o
|
||||
|
||||
# target to build an object file
|
||||
progs/string-manipulation/src/main.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/string-manipulation.dir/build.make CMakeFiles/string-manipulation.dir/progs/string-manipulation/src/main.c.o
|
||||
.PHONY : progs/string-manipulation/src/main.c.o
|
||||
src/C11.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C11.dir/build.make CMakeFiles/C11.dir/src/C11.c.o
|
||||
.PHONY : src/C11.c.o
|
||||
|
||||
progs/string-manipulation/src/main.i: progs/string-manipulation/src/main.c.i
|
||||
.PHONY : progs/string-manipulation/src/main.i
|
||||
src/C11.i: src/C11.c.i
|
||||
.PHONY : src/C11.i
|
||||
|
||||
# target to preprocess a source file
|
||||
progs/string-manipulation/src/main.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/string-manipulation.dir/build.make CMakeFiles/string-manipulation.dir/progs/string-manipulation/src/main.c.i
|
||||
.PHONY : progs/string-manipulation/src/main.c.i
|
||||
src/C11.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C11.dir/build.make CMakeFiles/C11.dir/src/C11.c.i
|
||||
.PHONY : src/C11.c.i
|
||||
|
||||
progs/string-manipulation/src/main.s: progs/string-manipulation/src/main.c.s
|
||||
.PHONY : progs/string-manipulation/src/main.s
|
||||
src/C11.s: src/C11.c.s
|
||||
.PHONY : src/C11.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
progs/string-manipulation/src/main.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/string-manipulation.dir/build.make CMakeFiles/string-manipulation.dir/progs/string-manipulation/src/main.c.s
|
||||
.PHONY : progs/string-manipulation/src/main.c.s
|
||||
src/C11.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C11.dir/build.make CMakeFiles/C11.dir/src/C11.c.s
|
||||
.PHONY : src/C11.c.s
|
||||
|
||||
src/C12.o: src/C12.c.o
|
||||
.PHONY : src/C12.o
|
||||
|
||||
# target to build an object file
|
||||
src/C12.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C12.dir/build.make CMakeFiles/C12.dir/src/C12.c.o
|
||||
.PHONY : src/C12.c.o
|
||||
|
||||
src/C12.i: src/C12.c.i
|
||||
.PHONY : src/C12.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/C12.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C12.dir/build.make CMakeFiles/C12.dir/src/C12.c.i
|
||||
.PHONY : src/C12.c.i
|
||||
|
||||
src/C12.s: src/C12.c.s
|
||||
.PHONY : src/C12.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/C12.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C12.dir/build.make CMakeFiles/C12.dir/src/C12.c.s
|
||||
.PHONY : src/C12.c.s
|
||||
|
||||
src/C2.o: src/C2.c.o
|
||||
.PHONY : src/C2.o
|
||||
|
||||
# target to build an object file
|
||||
src/C2.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C2.dir/build.make CMakeFiles/C2.dir/src/C2.c.o
|
||||
.PHONY : src/C2.c.o
|
||||
|
||||
src/C2.i: src/C2.c.i
|
||||
.PHONY : src/C2.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/C2.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C2.dir/build.make CMakeFiles/C2.dir/src/C2.c.i
|
||||
.PHONY : src/C2.c.i
|
||||
|
||||
src/C2.s: src/C2.c.s
|
||||
.PHONY : src/C2.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/C2.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C2.dir/build.make CMakeFiles/C2.dir/src/C2.c.s
|
||||
.PHONY : src/C2.c.s
|
||||
|
||||
src/C3.o: src/C3.c.o
|
||||
.PHONY : src/C3.o
|
||||
|
||||
# target to build an object file
|
||||
src/C3.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C3.dir/build.make CMakeFiles/C3.dir/src/C3.c.o
|
||||
.PHONY : src/C3.c.o
|
||||
|
||||
src/C3.i: src/C3.c.i
|
||||
.PHONY : src/C3.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/C3.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C3.dir/build.make CMakeFiles/C3.dir/src/C3.c.i
|
||||
.PHONY : src/C3.c.i
|
||||
|
||||
src/C3.s: src/C3.c.s
|
||||
.PHONY : src/C3.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/C3.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C3.dir/build.make CMakeFiles/C3.dir/src/C3.c.s
|
||||
.PHONY : src/C3.c.s
|
||||
|
||||
src/C4.o: src/C4.c.o
|
||||
.PHONY : src/C4.o
|
||||
|
||||
# target to build an object file
|
||||
src/C4.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C4.dir/build.make CMakeFiles/C4.dir/src/C4.c.o
|
||||
.PHONY : src/C4.c.o
|
||||
|
||||
src/C4.i: src/C4.c.i
|
||||
.PHONY : src/C4.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/C4.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C4.dir/build.make CMakeFiles/C4.dir/src/C4.c.i
|
||||
.PHONY : src/C4.c.i
|
||||
|
||||
src/C4.s: src/C4.c.s
|
||||
.PHONY : src/C4.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/C4.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C4.dir/build.make CMakeFiles/C4.dir/src/C4.c.s
|
||||
.PHONY : src/C4.c.s
|
||||
|
||||
src/C5.o: src/C5.c.o
|
||||
.PHONY : src/C5.o
|
||||
|
||||
# target to build an object file
|
||||
src/C5.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C5.dir/build.make CMakeFiles/C5.dir/src/C5.c.o
|
||||
.PHONY : src/C5.c.o
|
||||
|
||||
src/C5.i: src/C5.c.i
|
||||
.PHONY : src/C5.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/C5.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C5.dir/build.make CMakeFiles/C5.dir/src/C5.c.i
|
||||
.PHONY : src/C5.c.i
|
||||
|
||||
src/C5.s: src/C5.c.s
|
||||
.PHONY : src/C5.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/C5.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C5.dir/build.make CMakeFiles/C5.dir/src/C5.c.s
|
||||
.PHONY : src/C5.c.s
|
||||
|
||||
src/C6.o: src/C6.c.o
|
||||
.PHONY : src/C6.o
|
||||
|
||||
# target to build an object file
|
||||
src/C6.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C6.dir/build.make CMakeFiles/C6.dir/src/C6.c.o
|
||||
.PHONY : src/C6.c.o
|
||||
|
||||
src/C6.i: src/C6.c.i
|
||||
.PHONY : src/C6.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/C6.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C6.dir/build.make CMakeFiles/C6.dir/src/C6.c.i
|
||||
.PHONY : src/C6.c.i
|
||||
|
||||
src/C6.s: src/C6.c.s
|
||||
.PHONY : src/C6.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/C6.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C6.dir/build.make CMakeFiles/C6.dir/src/C6.c.s
|
||||
.PHONY : src/C6.c.s
|
||||
|
||||
src/C7.o: src/C7.c.o
|
||||
.PHONY : src/C7.o
|
||||
|
||||
# target to build an object file
|
||||
src/C7.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C7.dir/build.make CMakeFiles/C7.dir/src/C7.c.o
|
||||
.PHONY : src/C7.c.o
|
||||
|
||||
src/C7.i: src/C7.c.i
|
||||
.PHONY : src/C7.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/C7.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C7.dir/build.make CMakeFiles/C7.dir/src/C7.c.i
|
||||
.PHONY : src/C7.c.i
|
||||
|
||||
src/C7.s: src/C7.c.s
|
||||
.PHONY : src/C7.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/C7.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C7.dir/build.make CMakeFiles/C7.dir/src/C7.c.s
|
||||
.PHONY : src/C7.c.s
|
||||
|
||||
src/C8.o: src/C8.c.o
|
||||
.PHONY : src/C8.o
|
||||
|
||||
# target to build an object file
|
||||
src/C8.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C8.dir/build.make CMakeFiles/C8.dir/src/C8.c.o
|
||||
.PHONY : src/C8.c.o
|
||||
|
||||
src/C8.i: src/C8.c.i
|
||||
.PHONY : src/C8.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/C8.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C8.dir/build.make CMakeFiles/C8.dir/src/C8.c.i
|
||||
.PHONY : src/C8.c.i
|
||||
|
||||
src/C8.s: src/C8.c.s
|
||||
.PHONY : src/C8.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/C8.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C8.dir/build.make CMakeFiles/C8.dir/src/C8.c.s
|
||||
.PHONY : src/C8.c.s
|
||||
|
||||
src/C9.o: src/C9.c.o
|
||||
.PHONY : src/C9.o
|
||||
|
||||
# target to build an object file
|
||||
src/C9.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C9.dir/build.make CMakeFiles/C9.dir/src/C9.c.o
|
||||
.PHONY : src/C9.c.o
|
||||
|
||||
src/C9.i: src/C9.c.i
|
||||
.PHONY : src/C9.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/C9.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C9.dir/build.make CMakeFiles/C9.dir/src/C9.c.i
|
||||
.PHONY : src/C9.c.i
|
||||
|
||||
src/C9.s: src/C9.c.s
|
||||
.PHONY : src/C9.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/C9.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C9.dir/build.make CMakeFiles/C9.dir/src/C9.c.s
|
||||
.PHONY : src/C9.c.s
|
||||
|
||||
src/lib/lib.o: src/lib/lib.c.o
|
||||
.PHONY : src/lib/lib.o
|
||||
|
||||
# target to build an object file
|
||||
src/lib/lib.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C1.dir/build.make CMakeFiles/C1.dir/src/lib/lib.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C2.dir/build.make CMakeFiles/C2.dir/src/lib/lib.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C3.dir/build.make CMakeFiles/C3.dir/src/lib/lib.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C4.dir/build.make CMakeFiles/C4.dir/src/lib/lib.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C5.dir/build.make CMakeFiles/C5.dir/src/lib/lib.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C6.dir/build.make CMakeFiles/C6.dir/src/lib/lib.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C7.dir/build.make CMakeFiles/C7.dir/src/lib/lib.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C8.dir/build.make CMakeFiles/C8.dir/src/lib/lib.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C9.dir/build.make CMakeFiles/C9.dir/src/lib/lib.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C10.dir/build.make CMakeFiles/C10.dir/src/lib/lib.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C11.dir/build.make CMakeFiles/C11.dir/src/lib/lib.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C12.dir/build.make CMakeFiles/C12.dir/src/lib/lib.c.o
|
||||
.PHONY : src/lib/lib.c.o
|
||||
|
||||
src/lib/lib.i: src/lib/lib.c.i
|
||||
.PHONY : src/lib/lib.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lib/lib.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C1.dir/build.make CMakeFiles/C1.dir/src/lib/lib.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C2.dir/build.make CMakeFiles/C2.dir/src/lib/lib.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C3.dir/build.make CMakeFiles/C3.dir/src/lib/lib.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C4.dir/build.make CMakeFiles/C4.dir/src/lib/lib.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C5.dir/build.make CMakeFiles/C5.dir/src/lib/lib.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C6.dir/build.make CMakeFiles/C6.dir/src/lib/lib.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C7.dir/build.make CMakeFiles/C7.dir/src/lib/lib.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C8.dir/build.make CMakeFiles/C8.dir/src/lib/lib.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C9.dir/build.make CMakeFiles/C9.dir/src/lib/lib.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C10.dir/build.make CMakeFiles/C10.dir/src/lib/lib.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C11.dir/build.make CMakeFiles/C11.dir/src/lib/lib.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C12.dir/build.make CMakeFiles/C12.dir/src/lib/lib.c.i
|
||||
.PHONY : src/lib/lib.c.i
|
||||
|
||||
src/lib/lib.s: src/lib/lib.c.s
|
||||
.PHONY : src/lib/lib.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lib/lib.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C1.dir/build.make CMakeFiles/C1.dir/src/lib/lib.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C2.dir/build.make CMakeFiles/C2.dir/src/lib/lib.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C3.dir/build.make CMakeFiles/C3.dir/src/lib/lib.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C4.dir/build.make CMakeFiles/C4.dir/src/lib/lib.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C5.dir/build.make CMakeFiles/C5.dir/src/lib/lib.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C6.dir/build.make CMakeFiles/C6.dir/src/lib/lib.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C7.dir/build.make CMakeFiles/C7.dir/src/lib/lib.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C8.dir/build.make CMakeFiles/C8.dir/src/lib/lib.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C9.dir/build.make CMakeFiles/C9.dir/src/lib/lib.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C10.dir/build.make CMakeFiles/C10.dir/src/lib/lib.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C11.dir/build.make CMakeFiles/C11.dir/src/lib/lib.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C12.dir/build.make CMakeFiles/C12.dir/src/lib/lib.c.s
|
||||
.PHONY : src/lib/lib.c.s
|
||||
|
||||
src/src.o: src/src.c.o
|
||||
.PHONY : src/src.o
|
||||
|
||||
# target to build an object file
|
||||
src/src.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C1.dir/build.make CMakeFiles/C1.dir/src/src.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C2.dir/build.make CMakeFiles/C2.dir/src/src.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C3.dir/build.make CMakeFiles/C3.dir/src/src.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C4.dir/build.make CMakeFiles/C4.dir/src/src.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C5.dir/build.make CMakeFiles/C5.dir/src/src.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C6.dir/build.make CMakeFiles/C6.dir/src/src.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C7.dir/build.make CMakeFiles/C7.dir/src/src.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C8.dir/build.make CMakeFiles/C8.dir/src/src.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C9.dir/build.make CMakeFiles/C9.dir/src/src.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C10.dir/build.make CMakeFiles/C10.dir/src/src.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C11.dir/build.make CMakeFiles/C11.dir/src/src.c.o
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C12.dir/build.make CMakeFiles/C12.dir/src/src.c.o
|
||||
.PHONY : src/src.c.o
|
||||
|
||||
src/src.i: src/src.c.i
|
||||
.PHONY : src/src.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/src.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C1.dir/build.make CMakeFiles/C1.dir/src/src.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C2.dir/build.make CMakeFiles/C2.dir/src/src.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C3.dir/build.make CMakeFiles/C3.dir/src/src.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C4.dir/build.make CMakeFiles/C4.dir/src/src.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C5.dir/build.make CMakeFiles/C5.dir/src/src.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C6.dir/build.make CMakeFiles/C6.dir/src/src.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C7.dir/build.make CMakeFiles/C7.dir/src/src.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C8.dir/build.make CMakeFiles/C8.dir/src/src.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C9.dir/build.make CMakeFiles/C9.dir/src/src.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C10.dir/build.make CMakeFiles/C10.dir/src/src.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C11.dir/build.make CMakeFiles/C11.dir/src/src.c.i
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C12.dir/build.make CMakeFiles/C12.dir/src/src.c.i
|
||||
.PHONY : src/src.c.i
|
||||
|
||||
src/src.s: src/src.c.s
|
||||
.PHONY : src/src.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/src.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C1.dir/build.make CMakeFiles/C1.dir/src/src.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C2.dir/build.make CMakeFiles/C2.dir/src/src.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C3.dir/build.make CMakeFiles/C3.dir/src/src.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C4.dir/build.make CMakeFiles/C4.dir/src/src.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C5.dir/build.make CMakeFiles/C5.dir/src/src.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C6.dir/build.make CMakeFiles/C6.dir/src/src.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C7.dir/build.make CMakeFiles/C7.dir/src/src.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C8.dir/build.make CMakeFiles/C8.dir/src/src.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C9.dir/build.make CMakeFiles/C9.dir/src/src.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C10.dir/build.make CMakeFiles/C10.dir/src/src.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C11.dir/build.make CMakeFiles/C11.dir/src/src.c.s
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/C12.dir/build.make CMakeFiles/C12.dir/src/src.c.s
|
||||
.PHONY : src/src.c.s
|
||||
|
||||
# Help Target
|
||||
help:
|
||||
@ -236,18 +682,60 @@ help:
|
||||
@echo "... depend"
|
||||
@echo "... edit_cache"
|
||||
@echo "... rebuild_cache"
|
||||
@echo "... dynamic-memory"
|
||||
@echo "... file-operations"
|
||||
@echo "... string-manipulation"
|
||||
@echo "... progs/dynamic-memory/src/main.o"
|
||||
@echo "... progs/dynamic-memory/src/main.i"
|
||||
@echo "... progs/dynamic-memory/src/main.s"
|
||||
@echo "... progs/file-operations/src/main.o"
|
||||
@echo "... progs/file-operations/src/main.i"
|
||||
@echo "... progs/file-operations/src/main.s"
|
||||
@echo "... progs/string-manipulation/src/main.o"
|
||||
@echo "... progs/string-manipulation/src/main.i"
|
||||
@echo "... progs/string-manipulation/src/main.s"
|
||||
@echo "... C1"
|
||||
@echo "... C10"
|
||||
@echo "... C11"
|
||||
@echo "... C12"
|
||||
@echo "... C2"
|
||||
@echo "... C3"
|
||||
@echo "... C4"
|
||||
@echo "... C5"
|
||||
@echo "... C6"
|
||||
@echo "... C7"
|
||||
@echo "... C8"
|
||||
@echo "... C9"
|
||||
@echo "... src/C1.o"
|
||||
@echo "... src/C1.i"
|
||||
@echo "... src/C1.s"
|
||||
@echo "... src/C10.o"
|
||||
@echo "... src/C10.i"
|
||||
@echo "... src/C10.s"
|
||||
@echo "... src/C11.o"
|
||||
@echo "... src/C11.i"
|
||||
@echo "... src/C11.s"
|
||||
@echo "... src/C12.o"
|
||||
@echo "... src/C12.i"
|
||||
@echo "... src/C12.s"
|
||||
@echo "... src/C2.o"
|
||||
@echo "... src/C2.i"
|
||||
@echo "... src/C2.s"
|
||||
@echo "... src/C3.o"
|
||||
@echo "... src/C3.i"
|
||||
@echo "... src/C3.s"
|
||||
@echo "... src/C4.o"
|
||||
@echo "... src/C4.i"
|
||||
@echo "... src/C4.s"
|
||||
@echo "... src/C5.o"
|
||||
@echo "... src/C5.i"
|
||||
@echo "... src/C5.s"
|
||||
@echo "... src/C6.o"
|
||||
@echo "... src/C6.i"
|
||||
@echo "... src/C6.s"
|
||||
@echo "... src/C7.o"
|
||||
@echo "... src/C7.i"
|
||||
@echo "... src/C7.s"
|
||||
@echo "... src/C8.o"
|
||||
@echo "... src/C8.i"
|
||||
@echo "... src/C8.s"
|
||||
@echo "... src/C9.o"
|
||||
@echo "... src/C9.i"
|
||||
@echo "... src/C9.s"
|
||||
@echo "... src/lib/lib.o"
|
||||
@echo "... src/lib/lib.i"
|
||||
@echo "... src/lib/lib.s"
|
||||
@echo "... src/src.o"
|
||||
@echo "... src/src.i"
|
||||
@echo "... src/src.s"
|
||||
.PHONY : help
|
||||
|
||||
|
||||
@ -259,7 +747,6 @@ help:
|
||||
# No rule that depends on this can have commands that come from listfiles
|
||||
# because they might be regenerated.
|
||||
cmake_check_build_system:
|
||||
$(CMAKE_COMMAND) -P /home/sam/Git/College/Spring-2023/CS-2124/Assignment-1/CMakeFiles/VerifyGlobs.cmake
|
||||
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
|
||||
.PHONY : cmake_check_build_system
|
||||
|
||||
|
187
Spring-2023/CS-2124/Assignment-1/README.org
Normal file
@ -0,0 +1,187 @@
|
||||
#+LATEX_HEADER: \usepackage[margin=0.5in]{geometry}
|
||||
|
||||
* Assignment 1
|
||||
|
||||
ABC123: =zfp106=
|
||||
|
||||
Name: =Price Hiller=
|
||||
|
||||
Course: =CS2124=
|
||||
|
||||
Section: =0C3=
|
||||
|
||||
Semester: =Spring 2024=
|
||||
|
||||
** Source Code
|
||||
|
||||
The full source code for this project can be found at [[https://gitlab.orion-technologies.io/philler/college/-/tree/Development/Spring-2023/CS-2124/Assignment-1?ref_type=heads]]
|
||||
** Running the Programs
|
||||
1. Install [[https://cmake.org/download/][cmake]] version 3.25 or greater.
|
||||
2. Ensure you have recent version of ~make~ at the time of writing. This project successfully
|
||||
compiles with ~GNU make~ version ~4.4.1~.
|
||||
3. Go the directory with ~CMakeLists.txt~ and run ~cmake .~ to generate a Makefile.
|
||||
4. Run ~make all~ to compile all the programs.
|
||||
5. Go into the newly created ~bin~ directory where all the compiled programs will be output to.
|
||||
6. Run the programs in sequence, from ~C1~ to ~C12~ to ensure the file operations work as
|
||||
expected.
|
||||
|
||||
** Program Outputs and Question Solutions (C's)
|
||||
|
||||
*** C1 (Creation of a new file)
|
||||
|
||||
[[./assets/C1-output.png]]
|
||||
|
||||
*** C2 (Opening and closing an existing file)
|
||||
|
||||
[[./assets/C2-output.png]]
|
||||
|
||||
*** C3 (Writing to a file)
|
||||
|
||||
[[./assets/C3-output.png]]
|
||||
|
||||
*** C4 (Reading from file)
|
||||
|
||||
[[./assets/C4-output.png]]
|
||||
|
||||
*** C5 (Moving to a specific location in a file (end of file))
|
||||
|
||||
[[./assets/C5-output.png]]
|
||||
|
||||
*** C6 (Computes string's length and copies one string into another string)
|
||||
|
||||
[[./assets/C6-output.png]]
|
||||
|
||||
*** C7 (Concatenates(joins) two strings)
|
||||
|
||||
[[./assets/C7-output.png]]
|
||||
|
||||
*** C8 (Compares two strings)
|
||||
|
||||
[[./assets/C8-output.png]]
|
||||
|
||||
*** C9 (Converts String to lowercase)
|
||||
|
||||
[[./assets/C9-output.png]]
|
||||
|
||||
*** C10 (Converts string to uppercase)
|
||||
|
||||
[[./assets/C10-output.png]]
|
||||
|
||||
*** C11 (Dynamic Memory with Malloc)
|
||||
|
||||
[[./assets/C11-output.png]]
|
||||
|
||||
*** C12 (Dynamic Memory with Calloc)
|
||||
|
||||
[[./assets/C12-output.png]]
|
||||
|
||||
*** C13 (Describe the difference between ~malloc~ and ~calloc~)
|
||||
|
||||
~malloc~ and ~calloc~ both return a pointer to allocated memory for some purpose. The major
|
||||
difference is that ~calloc~, by default, will initialize all elements in that allocated memory
|
||||
to the value ~0~ whereas ~malloc~ does not modify anything in that block of memory before
|
||||
returning a pointer.
|
||||
|
||||
You can achieve a poor man's ~calloc~ by using ~malloc~ with ~memset~ to initialize the
|
||||
newly returned block of memory to ~0~ yourself. This will almost certainly be slower than most
|
||||
~calloc~ usages as ~calloc~ "knows" the kernel will return something known as a virtual zero page and
|
||||
thus will be receiving (on most systems) a chunk of memory that has all its values initialized
|
||||
to ~0~ by default. Thus ~calloc~ can "know" when it needs to allocate those ~0~'s itself or if
|
||||
it can skip the process and thereby be faster than ~malloc~ + ~memset~.
|
||||
|
||||
*** C14 (Explain pointers and pointers to pointers using code)
|
||||
|
||||
|
||||
**** *_Write code for pointer and use that code to explain pointers in your own words_*
|
||||
|
||||
#+BEGIN_SRC c
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
char *str = "Hello";
|
||||
while (*str != *"\0") {
|
||||
printf("Pointer Location: %p, Remaining Letters: %s\n", str, str);
|
||||
str++;
|
||||
}
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
If you run the code above it will output something similar to the following:
|
||||
#+BEGIN_SRC
|
||||
Pointer Location: 0x402008, Remaining Letters: Hello
|
||||
Pointer Location: 0x402009, Remaining Letters: ello
|
||||
Pointer Location: 0x40200a, Remaining Letters: llo
|
||||
Pointer Location: 0x40200b, Remaining Letters: lo
|
||||
Pointer Location: 0x40200c, Remaining Letters: o
|
||||
#+END_SRC
|
||||
|
||||
As you can see we're progressively incrementing the pointer location by one and outputting the
|
||||
remaining letters from the current pointer location to the end of the string until we hit the
|
||||
=NULL= character.
|
||||
|
||||
The line:
|
||||
~char *str = "Hello";~
|
||||
is really a pointer to some location that starts with the letter =H= and ends with a =NULL=
|
||||
character, =\0=.
|
||||
|
||||
By incrementing the pointer by one, we're moving the location it's /pointing/ at by one. After
|
||||
the first iteration through the while loop the ~*str~ pointer points at the letter ~e~. After
|
||||
the second iteration, ~*str~ points at ~l~, after the third iteration, ~l~, and so on.
|
||||
|
||||
In reality a pointer is something that /points/ to a place in memory. It doesn't contain a
|
||||
value itself, it merely points to where a value is stored. Hence why the output has the weird
|
||||
hex codes for =Pointer Location= like =0x402008=. That hex code is a location in memory known
|
||||
as a /memory address/ that ~*str~, the pointer, points to.
|
||||
|
||||
|
||||
**** *_Write a code for pointer to pointer and use that code to explain pointer to pointer in your own words_*
|
||||
|
||||
A pointer to pointer can be seen in the following code:
|
||||
#+BEGIN_SRC c
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
int some_integer = 106;
|
||||
int *pointer = &some_integer;
|
||||
int **pointer_to_pointer = &pointer;
|
||||
printf("Value: %d\nPointer: %p\nPointer to Pointer: %p\n", some_integer, pointer, pointer_to_pointer);
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
When we run the above it will output (pointer values may vary):
|
||||
#+BEGIN_SRC
|
||||
Value: 106
|
||||
Pointer: 0x7ffc87ea34d4
|
||||
Pointer to Pointer: 0x7ffc87ea34c8
|
||||
#+END_SRC
|
||||
|
||||
Notice that the ~pointer~ variable has a different address it points to than
|
||||
~pointer_to_pointer~.
|
||||
|
||||
The ~pointer~ variable points to the memory location of ~some_integer~ and the
|
||||
~pointer_to_pointer~ variable points to the memory location of where the ~pointer~ variable is
|
||||
stored.
|
||||
|
||||
With the above in mind, we can then think of a pointer to a pointer as a double indirection.
|
||||
See the following diagram for what this effectively "looks" like:
|
||||
#+BEGIN_EXAMPLE
|
||||
Pointer to Pointer ----> Pointer ----> Value
|
||||
#+END_EXAMPLE
|
||||
|
||||
Thus, if we only had the variable ~pointer_to_pointer~ we could access the value all the
|
||||
pointers ultimately point to with a multiple dereference like so:
|
||||
#+BEGIN_SRC c
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
int some_integer = 106;
|
||||
int *pointer = &some_integer;
|
||||
int **pointer_to_pointer = &pointer;
|
||||
printf("Deref'd Value from Pointer to Pointer: %d\n", **pointer_to_pointer);
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
Which will output:
|
||||
#+BEGIN_SRC
|
||||
Deref'd Value from Pointer to Pointer: 106
|
||||
#+END_SRC
|
BIN
Spring-2023/CS-2124/Assignment-1/assets/C1-output.png
Normal file
After Width: | Height: | Size: 105 KiB |
BIN
Spring-2023/CS-2124/Assignment-1/assets/C10-output.png
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
Spring-2023/CS-2124/Assignment-1/assets/C11-output.png
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
Spring-2023/CS-2124/Assignment-1/assets/C12-output.png
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
Spring-2023/CS-2124/Assignment-1/assets/C2-output.png
Normal file
After Width: | Height: | Size: 118 KiB |
BIN
Spring-2023/CS-2124/Assignment-1/assets/C3-output.png
Normal file
After Width: | Height: | Size: 100 KiB |
BIN
Spring-2023/CS-2124/Assignment-1/assets/C4-output.png
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
Spring-2023/CS-2124/Assignment-1/assets/C5-output.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
Spring-2023/CS-2124/Assignment-1/assets/C6-output.png
Normal file
After Width: | Height: | Size: 106 KiB |
BIN
Spring-2023/CS-2124/Assignment-1/assets/C7-output.png
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
Spring-2023/CS-2124/Assignment-1/assets/C8-output.png
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
Spring-2023/CS-2124/Assignment-1/assets/C9-output.png
Normal file
After Width: | Height: | Size: 47 KiB |
@ -1,4 +0,0 @@
|
||||
#include <stdio.h>
|
||||
int main(void)
|
||||
{
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
int main(void)
|
||||
{
|
||||
printf("1.) Creation of a new file:\n");
|
||||
char fname[] = {"p", "r", "i", "c", "e", ".", "t", "x", "t"};
|
||||
FILE *f = fopen(fname, "w+");
|
||||
printf("Filename: %s\nLocation: %s\n", fname, realpath(fname, NULL));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create a new file and output the file name and location of the file to STDOUT
|
||||
*/
|
||||
void create_new_file(char* filename) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Open and close an existing file and output the location of the file to STDOUT
|
||||
*/
|
||||
void open_and_close_existing_file() {}
|
||||
|
||||
/**
|
||||
* @brief Open and write
|
||||
*/
|
||||
void write_to_a_file() {}
|
@ -1,4 +0,0 @@
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
16
Spring-2023/CS-2124/Assignment-1/src/C1.c
Normal file
@ -0,0 +1,16 @@
|
||||
#include "src.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void c1() {
|
||||
FILE *f = fopen(FNAME, "w+");
|
||||
solve(1, "Creation of a new file",
|
||||
fmtstr("Filename: %s\nLocation: %s", FNAME, get_file_path(FNAME)));
|
||||
}
|
||||
|
||||
int main() {
|
||||
print_header();
|
||||
c1();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
24
Spring-2023/CS-2124/Assignment-1/src/C10.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include "src.h"
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void c10() {
|
||||
size_t lname_len2 = strlen(LAST_NAME);
|
||||
char *upper_last = malloc(lname_len2);
|
||||
const char *lname = LAST_NAME;
|
||||
char *b = upper_last;
|
||||
while (lname_len2--)
|
||||
*b++ = toupper(*lname++);
|
||||
|
||||
solve(9, "Converts string to uppercase",
|
||||
fmtstr("Original String: %s\nUppercased String: %s", LAST_NAME,
|
||||
upper_last));
|
||||
|
||||
}
|
||||
|
||||
int main() {
|
||||
print_header();
|
||||
c10();
|
||||
return 0;
|
||||
}
|
36
Spring-2023/CS-2124/Assignment-1/src/C11.c
Normal file
@ -0,0 +1,36 @@
|
||||
#include "src.h"
|
||||
#include "src.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void c11() {
|
||||
int num_elements;
|
||||
printf("Enter number of elements (Malloc): ");
|
||||
scanf("%d", &num_elements);
|
||||
// Allocate the needed memory
|
||||
int *elements = malloc(sizeof(int) * num_elements);
|
||||
|
||||
// Read the values in one by one into the memory
|
||||
printf("Enter elements:\n");
|
||||
int *end_addr = elements + num_elements; // Find end of memory region
|
||||
while (elements < end_addr) {
|
||||
scanf("%d", elements);
|
||||
elements++;
|
||||
}
|
||||
elements--; // Slight offset to ensure correct alignment of the pointer
|
||||
|
||||
printf("\n"); // Insert newline to separator reads from output
|
||||
|
||||
// Reset the pointer to the start of the memory region
|
||||
elements = elements - num_elements;
|
||||
while (num_elements--) {
|
||||
elements++;
|
||||
printf("Memory Address of %d is %p\n", *elements, elements);
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
print_header();
|
||||
c11();
|
||||
return 0;
|
||||
}
|
35
Spring-2023/CS-2124/Assignment-1/src/C12.c
Normal file
@ -0,0 +1,35 @@
|
||||
#include "src.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void c12() {
|
||||
int num_elements;
|
||||
printf("Enter number of elements (Calloc): ");
|
||||
scanf("%d", &num_elements);
|
||||
// Allocate the needed memory
|
||||
int *elements = calloc(num_elements, sizeof(int));
|
||||
|
||||
// Read the values in one by one into the memory
|
||||
printf("Enter elements:\n");
|
||||
int *end_addr = elements + num_elements; // Find end of memory region
|
||||
while (elements < end_addr) {
|
||||
scanf("%d", elements);
|
||||
elements++;
|
||||
}
|
||||
elements--; // Slight offset to ensure correct alignment of the pointer
|
||||
|
||||
printf("\n"); // Insert newline to separator reads from output
|
||||
|
||||
// Reset the pointer to the start of the memory region
|
||||
elements = elements - num_elements;
|
||||
while (num_elements--) {
|
||||
elements++;
|
||||
printf("Memory Address of %d is %p\n", *elements, elements);
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
print_header();
|
||||
c12();
|
||||
return 0;
|
||||
}
|
16
Spring-2023/CS-2124/Assignment-1/src/C2.c
Normal file
@ -0,0 +1,16 @@
|
||||
#include "src.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void c2() {
|
||||
FILE *f = fopen(FNAME, "r");
|
||||
fclose(f);
|
||||
solve(
|
||||
2, "Opening and closing an existing file",
|
||||
fmtstr("Opened and closed file located at: %s", get_file_path(FNAME)));
|
||||
}
|
||||
|
||||
int main() {
|
||||
print_header();
|
||||
c2();
|
||||
return 0;
|
||||
}
|
16
Spring-2023/CS-2124/Assignment-1/src/C3.c
Normal file
@ -0,0 +1,16 @@
|
||||
#include "src.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void c3() {
|
||||
FILE *f = fopen(FNAME, "w+");
|
||||
fprintf(f, "106");
|
||||
fclose(f);
|
||||
solve(3, "Writing to a file",
|
||||
fmtstr("Wrote '106' to: %s", get_file_path(FNAME)));
|
||||
}
|
||||
|
||||
int main() {
|
||||
print_header();
|
||||
c3();
|
||||
return 0;
|
||||
}
|
17
Spring-2023/CS-2124/Assignment-1/src/C4.c
Normal file
@ -0,0 +1,17 @@
|
||||
#include "src.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void c4() {
|
||||
FILE *f = fopen(FNAME, "r");
|
||||
int fcontent;
|
||||
fscanf(f, "%d", &fcontent);
|
||||
fclose(f);
|
||||
solve(4, "Reading from file",
|
||||
fmtstr("Read from file: %s\nContent read: %d", FNAME, fcontent));
|
||||
}
|
||||
|
||||
int main() {
|
||||
print_header();
|
||||
c4();
|
||||
return 0;
|
||||
}
|
17
Spring-2023/CS-2124/Assignment-1/src/C5.c
Normal file
@ -0,0 +1,17 @@
|
||||
#include "src.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void c5() {
|
||||
FILE *f = fopen(FNAME, "r");
|
||||
fseek(f, 0L, SEEK_END);
|
||||
int foffset = ftell(f);
|
||||
fclose(f);
|
||||
solve(5, "Moving to a specific location in a file (end of file)",
|
||||
fmtstr("Location in %s: %d", FNAME, foffset));
|
||||
}
|
||||
|
||||
int main() {
|
||||
print_header();
|
||||
c5();
|
||||
return 0;
|
||||
}
|
22
Spring-2023/CS-2124/Assignment-1/src/C6.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include "src.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void c6() {
|
||||
size_t str_len = strlen(FIRST_NAME);
|
||||
char *newstr = malloc(str_len + 1);
|
||||
// strcpy is just calling memcpy under
|
||||
// the hood
|
||||
memcpy(newstr, FIRST_NAME, str_len + 1);
|
||||
solve(6,
|
||||
"Computes string's length and copies one string into another string",
|
||||
fmtstr("String: %s, Location %p\nLength: %d\nCopied String: %s, Location: %p", FIRST_NAME, &FIRST_NAME,
|
||||
str_len, newstr, &newstr));
|
||||
}
|
||||
|
||||
int main() {
|
||||
print_header();
|
||||
c6();
|
||||
return 0;
|
||||
}
|
18
Spring-2023/CS-2124/Assignment-1/src/C7.c
Normal file
@ -0,0 +1,18 @@
|
||||
#include "src.h"
|
||||
#include <string.h>
|
||||
|
||||
void c7() {
|
||||
char concat_str[strlen(FIRST_NAME) + strlen(LAST_NAME)];
|
||||
strcpy(concat_str, FIRST_NAME);
|
||||
strcat(concat_str, " ");
|
||||
strcat(concat_str, LAST_NAME);
|
||||
|
||||
solve(7, "Concatenates(joins) two strings",
|
||||
fmtstr("First & Last Name Concatenated: %s", concat_str));
|
||||
}
|
||||
|
||||
int main() {
|
||||
print_header();
|
||||
c7();
|
||||
return 0;
|
||||
}
|
21
Spring-2023/CS-2124/Assignment-1/src/C8.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include "src.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void c8() {
|
||||
char *names_equal = malloc(sizeof(char) * 256);
|
||||
if (!strcmp(FIRST_NAME, LAST_NAME)) {
|
||||
names_equal = "Strings are the same";
|
||||
} else {
|
||||
names_equal = "Strings are different";
|
||||
}
|
||||
solve(8, "Compares two strings",
|
||||
fmtstr("Comparing '%s' to '%s'\nSame?: %s", FIRST_NAME, LAST_NAME,
|
||||
names_equal));
|
||||
}
|
||||
|
||||
int main() {
|
||||
print_header();
|
||||
c8();
|
||||
return 0;
|
||||
}
|
26
Spring-2023/CS-2124/Assignment-1/src/C9.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include "src.h"
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void c9(){
|
||||
size_t lname_len = strlen(LAST_NAME);
|
||||
char *lower_last = malloc(lname_len);
|
||||
|
||||
// Slightly faster way to memcpy for this purpose, might as well also copy
|
||||
// in the lowercased variant of the source
|
||||
const char *lname = LAST_NAME;
|
||||
char *d = lower_last;
|
||||
while (lname_len--)
|
||||
*d++ = tolower(*lname++);
|
||||
|
||||
solve(9, "Converts string to lowercase",
|
||||
fmtstr("Original String: %s\nLowercased String: %s", LAST_NAME,
|
||||
lower_last));
|
||||
}
|
||||
|
||||
int main() {
|
||||
print_header();
|
||||
c9();
|
||||
return 0;
|
||||
}
|
70
Spring-2023/CS-2124/Assignment-1/src/lib/lib.c
Normal file
@ -0,0 +1,70 @@
|
||||
// Credit to
|
||||
// https://stackoverflow.com/questions/40159892/using-asprintf-on-windows/49873938#49873938
|
||||
// with modifications by me
|
||||
|
||||
|
||||
#include <stdarg.h> /* needed for va_* */
|
||||
#include <stdio.h> /* needed for vsnprintf */
|
||||
#include <stdlib.h> /* needed for malloc, free */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <linux/limits.h>
|
||||
#endif
|
||||
|
||||
int vscprintf(const char *format, va_list ap) {
|
||||
va_list ap_copy;
|
||||
va_copy(ap_copy, ap);
|
||||
int retval = vsnprintf(NULL, 0, format, ap_copy);
|
||||
va_end(ap_copy);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* asprintf, vasprintf:
|
||||
* MSVC does not implement these, thus we implement them here
|
||||
* GNU-C-compatible compilers implement these with the same names, thus we
|
||||
* don't have to do anything
|
||||
*/
|
||||
int vasprintf(char **strp, const char *format, va_list ap) {
|
||||
int len = vscprintf(format, ap);
|
||||
if (len == -1)
|
||||
return -1;
|
||||
char *str = (char *)malloc((size_t)len + 1);
|
||||
if (!str)
|
||||
return -1;
|
||||
int retval = vsnprintf(str, len + 1, format, ap);
|
||||
if (retval == -1) {
|
||||
free(str);
|
||||
return -1;
|
||||
}
|
||||
*strp = str;
|
||||
return retval;
|
||||
}
|
||||
|
||||
char* fmtstr(const char *format, ...) {
|
||||
char *str = NULL;
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vasprintf(&str, format, ap);
|
||||
va_end(ap);
|
||||
return str;
|
||||
}
|
||||
|
||||
char *get_file_path(char *fname) {
|
||||
#ifdef _WIN32
|
||||
char fp[_MAX_PATH];
|
||||
return _fullpath(fp, fname, _MAX_PATH);
|
||||
#else
|
||||
char fp[PATH_MAX - 1];
|
||||
return realpath(fname, fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
void solve(int problem_number, char *problem, char *solution) {
|
||||
printf("=========================\n%d.) %s\n"
|
||||
"-------------------------\n"
|
||||
"%s\n\n",
|
||||
problem_number, problem, solution);
|
||||
}
|
36
Spring-2023/CS-2124/Assignment-1/src/lib/lib.h
Normal file
@ -0,0 +1,36 @@
|
||||
// Credit to
|
||||
// https://stackoverflow.com/questions/40159892/using-asprintf-on-windows/49873938#49873938
|
||||
// with modifications by me
|
||||
|
||||
#ifndef FMTSTR_H
|
||||
#define FMTSTR_H
|
||||
|
||||
#if defined(__GNUC__) && !defined(_GNU_SOURCE)
|
||||
#define _GNU_SOURCE /* needed for (v)asprintf, affects '#include <stdio.h>' */
|
||||
#endif
|
||||
|
||||
#include <stdarg.h> /* needed for va_* */
|
||||
|
||||
/*
|
||||
* vscprintf:
|
||||
* MSVC implements this as _vscprintf, thus we just 'symlink' it here
|
||||
* GNU-C-compatible compilers do not implement this, thus we implement it here
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#define vscprintf _vscprintf
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
int vasprintf(char **strp, const char *format, va_list ap);
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
int vscprintf(const char *format, va_list ap);
|
||||
#endif
|
||||
|
||||
char* fmtstr(const char *format, ...);
|
||||
char *get_file_path(char *fname);
|
||||
void solve(int problem_number, char *problem, char *solution);
|
||||
|
||||
#endif
|
6
Spring-2023/CS-2124/Assignment-1/src/src.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include "src.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void print_header() {
|
||||
printf("%s\n", HEADER_LINE);
|
||||
}
|
22
Spring-2023/CS-2124/Assignment-1/src/src.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef SRC_H
|
||||
#define SRC_H
|
||||
#define FNAME "Price.txt"
|
||||
#define FIRST_NAME "Price"
|
||||
#define LAST_NAME "Hiller"
|
||||
#define LAST_THREE_DIGITS_ABC "106"
|
||||
#define HEADER_LINE "Spring 2024 - CS2124 OC3, zfp106"
|
||||
#include "lib/lib.h"
|
||||
void c1();
|
||||
void c2();
|
||||
void c3();
|
||||
void c4();
|
||||
void c5();
|
||||
void c6();
|
||||
void c7();
|
||||
void c8();
|
||||
void c9();
|
||||
void c10();
|
||||
void c11();
|
||||
void c12();
|
||||
void print_header();
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
* TODO Assignment 1
|
||||
* DONE Assignment 1
|
||||
DEADLINE: <2024-01-26 Fri> SCHEDULED: <2024-01-25 Thu>
|
||||
|
||||
Complete Zybooks section ~1~ and the first homework assignment
|
||||
|