-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
280 changed files
with
16,188 additions
and
18,377 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Build zlib from the included sources, it generates the target | ||
# zlibstatic that we can link statically to | ||
set(SKIP_INSTALL_ALL ON) # skip install targets of zlib | ||
|
||
set(Z_DIR zlib-1.3) | ||
set(MZ_DIR ${Z_DIR}/contrib/minizip) | ||
|
||
add_subdirectory(${Z_DIR} EXCLUDE_FROM_ALL) | ||
set_property(TARGET zlibstatic PROPERTY POSITION_INDEPENDENT_CODE ON) | ||
|
||
set(ZLIB_INCLUDE_DIRS ./${Z_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${Z_DIR} ./${MZ_DIR}) | ||
|
||
set(AMPLXL_SOURCES | ||
./src/ampl_xl.cpp | ||
./src/myunz.cpp | ||
./src/myzip.cpp | ||
./src/copyzip.cpp | ||
./src/pugixml.cpp | ||
./src/oxmlutils.cpp | ||
./src/logger.cpp | ||
./src/utils.cpp | ||
./${MZ_DIR}/ioapi.c | ||
./${MZ_DIR}/zip.c | ||
./${MZ_DIR}/unzip.c) | ||
|
||
if (WIN32) | ||
set(AMPLXL_SOURCES ${AMPLXL_SOURCES} ./${MZ_DIR}//iowin32.c) | ||
endif() | ||
|
||
add_ampl_library(amplxl ${AMPLXL_SOURCES} | ||
COMPONENT ${DISTRO_COMPONENT}) | ||
|
||
set_target_properties(amplxl PROPERTIES LINKER_LANGUAGE CXX) | ||
target_link_libraries(amplxl PRIVATE asl2 zlibstatic) | ||
target_include_directories(amplxl PRIVATE ${ZLIB_INCLUDE_DIRS}) | ||
|
||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/tests DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/amplxl) | ||
file(COPY ../test_utils.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/amplxl/tests) | ||
add_test(NAME amplxl-test COMMAND ${PYTHON_PROGRAM} | ||
${CMAKE_CURRENT_BINARY_DIR}/amplxl/tests/test.py ${AMPL_PROGRAM} $<TARGET_FILE:amplxl>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
A table handler for spreadsheet files (.xlsx). | ||
|
||
General information on table handlers and data correspondence between AMPL and | ||
an external table is available at chapter 10 of the AMPL book: | ||
|
||
https://ampl.com/learn/ampl-book/ | ||
|
||
The available options for amplxl are: | ||
|
||
2D | ||
Keyword to to specify that data indexed over two sets will be represented in | ||
a two-dimensional table, with keys from one set labeling the rows, and keys | ||
from the other set labeling the columns. | ||
|
||
Example: | ||
table foo IN "amplxl" "2D": [keycol1, keycol2], valcol; | ||
|
||
alias: | ||
Instead of writing the data to a specific .xlsx file it is possible to | ||
define an alias. In the following example the table handler will search for | ||
the file bar.xlsx to write the data. If the file does not exist it will be | ||
created. | ||
|
||
Example: | ||
table foo OUT "amplxl" "bar": [A], B; | ||
|
||
backup=option | ||
Whether or not to backup the existing .xlsx file before writing to it. | ||
The backup will create a file with the same name as the provided .xlsx file | ||
but with an .amplback extension. To use the backup file rename the .amplback | ||
extension to .xlsx. | ||
Options: true (default), false. | ||
|
||
Example: | ||
table foo OUT "amplxl" "backup=false": [keycol1, keycol2], valcol; | ||
|
||
external-table-spec: | ||
Specifies the path to the .xlsx file to be read or written with the read | ||
table and write table commands. If no file is specified, amplxl will search | ||
for a file with the table name and the .xlsx file extension in the current | ||
directory. If the table is to be written and the file does not exist it will | ||
be created. | ||
|
||
Example: | ||
table foo OUT "amplxl" "bar.xlsx": [keycol], valcol; | ||
|
||
verbose: | ||
Display warnings during the execution of the read table and write table | ||
commands. | ||
|
||
Example: | ||
table foo OUT "amplxl" "verbose": [keycol], valcol; | ||
|
||
verbose=option: | ||
Display information according to the specified option. Available options: | ||
0 (default) - display information only on error, | ||
1 - display warnings, | ||
2 - display general information | ||
3 - display debug information. | ||
|
||
Example: | ||
table foo OUT "amplxl" "verbose=2": [keycol], valcol; | ||
|
||
write=option | ||
Define how the data is written in OUT mode. Available options: | ||
delete (default) - deletes all the rows of the current table (if it | ||
exists) before writing the data from AMPL. | ||
append - append the rows in AMPL to the external representation of the | ||
table. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.