golf-601.4.41-1/0000775000175000017500000000000015021067666011453 5ustar bearbeargolf-601.4.41-1/PKGBUILD0000664000175000017500000000273315021067663012601 0ustar bearbear# SPDX-License-Identifier: Apache-2.0 # Copyright 2018-2025 Gliim LLC. # Licensed under Apache License v2. See LICENSE file. # On the web http://golf-lang.com/ - this file is part of Golf framework. # Build locally: makepkg --noconfirm -s # Check this file: namcap PKGBUILD # Run installer: sudo pacman -U --noconfirm # Maintainer: Gliim LLC pkgname=golf pkgver=601.4.41 pkgrel=0 epoch= pkgdesc="Programming language and application server for building and running web services and web applications. High performance and memory-safe." arch=("x86_64") url="https://golf-lang.com" license=('Apache-2.0') groups=() #NOTE: when depends change, makepkg --printsrcinfo >.SRCINFO must run to refresh .SRCINFO !! depends=(make gcc openssl curl 'mariadb-libs' fcgi 'postgresql-libs' sqlite3 pcre2 libxml2 man-db) makedepends=() checkdepends=() optdepends=() provides=(golf) conflicts=() replaces=() backup=() options=() install=arch.install changelog= source=("${pkgname}-${pkgver}.tar.gz::https://github.com/golf-lang/golf/archive/refs/tags/${pkgver}.tar.gz") noextract=() md5sums=(SKIP) validpgpkeys=() prepare() { tar xvfz ${pkgname}-${pkgver}.tar.gz } build() { cd "${pkgname}-${pkgver}" make DESTDIR="$pkgdir/" clean make DESTDIR="$pkgdir/" } check() { cd "${pkgname}-${pkgver}" } package() { cd "${pkgname}-${pkgver}" make DESTDIR="$pkgdir/" install } post_install() { echo "Setting up man pages..." mandb >/dev/null 2>&1 || true } golf-601.4.41-1/arch.install0000664000175000017500000000017515021067663013760 0ustar bearbearpost_install() { echo "Setting up man pages..." mandb >/dev/null 2>&1 || true } post_upgrade() { post_install $1 } golf-601.4.41-1/docs/0000775000175000017500000000000015021067665012402 5ustar bearbeargolf-601.4.41-1/docs/change-mode.2gg0000664000175000017500000000265215021067663015155 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME change-mode \- (directories files) .SH PURPOSE Change permission mode for a file or directory. .SH SYNTAX .RS 4 .EX change-mode mode [ status ] .EE .RE .SH DESCRIPTION change-mode will change permission mode for to as specified in "mode" clause. is a number, typically specified as octal (such as for instance 0750), see \fBpermissions\fP. is a string that may be an absolute or relative path. If "status" clause is used, then number is GG_OKAY if succeeded, GG_ERR_EXIST if file or directory does not exist, or GG_ERR_FAILED for other errors (in which case you can use "errno" clause in \fBget-req\fP to find the specific reason why). .SH EXAMPLES To give read and write privilege to user's group members ("6" means that as a second digit): .RS 4 .EX change-mode "myfile" mode 0760 .EE .RE .SH SEE ALSO Directories \fBchange-dir\fP \fBchange-mode\fP \fBdelete-dir\fP \fBdirectories\fP \fBnew-dir\fP Files \fBchange-mode\fP \fBclose-file\fP \fBcopy-file\fP \fBdelete-file\fP \fBfile-position\fP \fBfile-storage\fP \fBfile-uploading\fP \fBlock-file\fP \fBopen-file\fP \fBread-file\fP \fBread-line\fP \fBrename-file\fP \fBstat-file\fP \fBtemporary-file\fP \fBuniq-file\fP \fBunlock-file\fP \fBwrite-file\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/new-array.2gg0000664000175000017500000000404615021067664014713 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME new-array \- (array) .SH PURPOSE Create array. .SH SYNTAX .RS 4 .EX new-array [ max-size ] [ process-scope ] [ type string | number | bool ] .EE .RE .SH DESCRIPTION new-array creates new . An array is an indexed array, with a number as an index, and with a either a string, number or boolean as an element in the array. By default (without "type" clause), is an array of strings. You can specify "string", "number" or "bool" in "type" clause, in which case is an array of strings, numbers or booleans respectively. An array is flexible, which means that it will grow as needed. By default, an array allocates room for 256 elements that can grow up to 1,000,000 elements, unless number (in "max-size" clause) is specified in which case it can grow up to elements. must be at least 256. Note that max-size specifies only the upper limit of allocation. The actual amount of memory allocated can vary. You do not need to pre-size the array; rather when you write an element, it will resize automatically. For instance, you can set an array element arr[0] and then arr[1000] (with nothing in-between), the array will be automatically extended to accommodate. Note that it will not automatically contract when tailing elements are deleted. Use \fBpurge-array\fP to delete all elements in the array and shrink its memory footprint when your processing is done. .LP .B SCOPE .LP Note that an array is accessible to the current request only, unless "process-scope" clause is used, in which case all requests served by a process can use it (see \fBdo-once\fP for a typical way to do this). If "process-scope" is used, then will keep its data across all requests in a given process. See \fBwrite-array\fP for an example of a process-scoped array. .SH EXAMPLES Create a new array: .RS 4 .EX new-array arr .EE .RE .SH SEE ALSO Array \fBnew-array\fP \fBpurge-array\fP \fBread-array\fP \fBwrite-array\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/exit-status.2gg0000664000175000017500000000222415021067664015274 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME exit-status \- (program-execution) .SH PURPOSE Set handler exit status. .SH SYNTAX .RS 4 .EX exit-status .EE .RE .SH DESCRIPTION exit-status specifies , which must be a number. can be obtained with "exit-status" clause in \fBread-remote\fP in the service caller. When the program runs as \fBcommand-line\fP, is program's exit code. exit-status can be specified anywhere in the code, and does not mean exiting the \fBrequest\fP's processing; to do that, either use \fBexit-handler\fP or simply allow the handler to reach its end. When exit-status is not used, the default exit code is 0. When multiple exit-status statements run in a sequence, the request status is that of the last one that executes. If you want to specify request status and exit request processing at the same time, use \fBexit-handler\fP. .SH EXAMPLES When the program exits, its exit code will be 12: .RS 4 .EX exit-status 12 \[char46].. exit-handler .EE .RE .SH SEE ALSO Program execution \fBexec-program\fP \fBexit-status\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/new-dir.2gg0000664000175000017500000000157415021067664014356 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME new-dir \- (directories) .SH PURPOSE Create new directory. .SH SYNTAX .RS 4 .EX new-dir [ mode ] [ status ] .EE .RE .SH DESCRIPTION new-dir creates new , which is a string that is an absolute or relative path. You can specify permission (in "mode" clause) as a number, based on standard Linux permissions (see \fBpermissions\fP). If "status" clauses is used, is a number with value of GG_OKAY if successful, GG_ERR_EXIST if directory exists, or GG_ERR_FAILED for other errors (in which case you can use "errno" clause in \fBget-req\fP to find the specific reason why). .SH EXAMPLES .RS 4 .EX new-dir "new_dir" .EE .RE .SH SEE ALSO Directories \fBchange-dir\fP \fBchange-mode\fP \fBdelete-dir\fP \fBdirectories\fP \fBnew-dir\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/begin-transaction.2gg0000664000175000017500000000470415021067663016415 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME begin-transaction \- (database) .SH PURPOSE Begins database transaction. .SH SYNTAX .RS 4 .EX begin-transaction [ @ ] \\ [ on-error-continue | on-error-exit ] \\ [ error ] [ error-text ] \\ [ options ] .EE .RE .SH DESCRIPTION This statement begins a database transaction. (in "options" clause) is any additional options to send to database you wish to supply for this functionality. Once you start a transaction with \fBbegin-transaction\fP, you must either commit it with \fBcommit-transaction\fP or rollback with \fBrollback-transaction\fP. If you do neither, your transaction will be rolled back once the \fBrequest\fP has completed and your program will stop with an error message. This is because opening a transaction and leaving without committing or a rollback is a bug in your program. You must use begin-transaction, commit-transaction and rollback-transaction instead of calling this functionality through \fBrun-query\fP. .LP .B DATABASE .LP is specified in "@" clause and is the name of the \fBdatabase-config-file\fP. If omitted, your program must use exactly one database (see --db option in \fBgg\fP). .LP .B ERROR HANDLING .LP The error code is available in variable in "error" clause - this code is always "0" if successful. The code may or may not be a number but is always returned as a string value. In case of error, error text is available in "error-text" clause in string. "on-error-continue" clause specifies that \fBrequest\fP processing will continue in case of an error, whereas "on-error-exit" clause specifies that it will exit. This setting overrides database-level \fBdb-error\fP for this specific statement only. If you use "on-error-continue", be sure to check the error code. Note that if database connection was lost, and could not be reestablished, the request will error out (see \fBerror-handling\fP). .SH EXAMPLES .RS 4 .EX begin-transaction @mydb run-query @mydb="insert into employee (name, dateOfHire) values ('%s', now())" input "Terry" no-loop commit-transaction @mydb .EE .RE .SH SEE ALSO Database \fBbegin-transaction\fP \fBcommit-transaction\fP \fBcurrent-row\fP \fBdatabase-config-file\fP \fBdb-error\fP \fBmariadb-database\fP \fBpostgresql-database\fP \fBrollback-transaction\fP \fBrun-query\fP \fBsqlite-database\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/set-string.2gg0000664000175000017500000000651115021067665015105 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME set-string \- (strings) .SH PURPOSE Set value of a string variable. .SH SYNTAX .RS 4 .EX set-string [ unquoted ] [ process-scope ] [ = ] set-string [ ] = set-string length .EE .RE .SH DESCRIPTION String variable will be assigned a value of if clause "=" is present; otherwise is assigned an empty string. If "process-scope" clause is used, then will be of process scope, meaning its value will persist from one \fBrequest\fP to another for the life of the process; this clause can only be used if did not already exist. If "length" clause is used, then the length of string is set to . Just like with all other string statements, you can only set the new length of the string between zero and the current string length. This is useful mostly when manipulating string's individual bytes, and generally not in other cases (see \fBnew-string\fP). If "unquoted" clause is used, then literal is unquoted, and everything from equal clause ("=") to the rest of the line is a ; in this case there is no need to escape double quotes or backslashes. Note that in this case, "unquoted" and any other clause must appear prior to equal clause ("=") and after variable, because they wouldn't otherwise be recognized. For instance: .RS 4 .EX set-string my_string unquoted = this is "some" string where there escape characters like \en do "not work" .EE .RE This is the same as: .RS 4 .EX set-string my_string = "this is \[char92]"some\[char92]" string where there escape characters like \en do \[char92]"not work\[char92]"" .EE .RE "unquoted" clause is useful when writing string literals that would otherwise need lots of escaping. You can use double backslash at the end of the line to split the line with new line in between: .RS 4 .EX set-string unq1 unquoted =This is one line\\\ second line and\\\ third! .EE .RE The above will create a string: .RS 4 .EX This is one line second line and third! .EE .RE A string can be represented as a concatenation of string literals; this is useful when you want to preserve spaces, for instance: .RS 4 .EX set-string a="something is " \\ " very good " \\ " with spaces!! " // string is "something is very good with spaces!! " .EE .RE You can also use set-string to set a byte in it; in this case byte in string is set to . starts with 0 for the first byte. For instance, the resulting "str" will be "Aome string" since 65 is a number representation of 'A': .RS 4 .EX set-string str = "some string" set-string str[0] = 65 // or using a character constant as a number, to the same effect set-string str[0] = 'A' .EE .RE .SH EXAMPLES Initialize "my_string" variable to "": .RS 4 .EX set-string my_string .EE .RE Initialize "my_string" variable to "abc": .RS 4 .EX set-string my_string = "abc" .EE .RE .SH SEE ALSO Strings \fBconcatenate-strings\fP \fBcopy-string\fP \fBcount-substring\fP \fBdelete-string\fP \fBlower-string\fP \fBnew-string\fP \fBread-split\fP \fBreplace-string\fP \fBset-string\fP \fBsplit-string\fP \fBstring-length\fP \fBtrim-string\fP \fBupper-string\fP \fBwrite-string\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/unused-var.2gg0000664000175000017500000000214315021067665015074 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME unused-var \- (language) .SH PURPOSE Prevent compiler error if variable is not used. .SH SYNTAX .RS 4 .EX unused-var [ , ... ] .EE .RE .SH DESCRIPTION unused-var prevents \fBerroring out\fP if is unused; a list of variable names can be specified separated by a comma. Generally, you don't want to have unused variables - they typically indicate bugs or clutter. However, in some cases you might need such variables as a reminder for a future enhancement, or for some other reason it is unavoidable. In any case, you can use unused-var to shield such instances from causing errors. .SH EXAMPLES In the following, variable "hw" is created and initialized. Such variable is not used at the moment, however if you would do so in the future and want to keep it, use unused-var to prevent compiler errors: .RS 4 .EX set-string hw = "Hello world" unused-var hw .EE .RE .SH SEE ALSO Language \fBinline-code\fP \fBstatements\fP \fBsyntax-highlighting\fP \fBunused-var\fP \fBvariable-scope\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/code-blocks.2gg0000664000175000017500000000254115021067663015170 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME code-blocks \- Golf documentation (program-flow) .SH DESCRIPTION .LP .B CODE BLOCKS .LP Use curly braces ("{" and "}") to open and close a code block. They create a separate scope for previously non-existing variables defined within them, which begins with "{" and ends with "}". Note that if a variable existed in an outer scope, it cannot be created in the inner scope. Note that \fBif-true\fP, \fBrun-query\fP, \fBstart-loop\fP and \fBread-line\fP statements contain implicit code blocks, meaning the code between them and the accompanying end-statement is within implicit "{" and "}". .SH EXAMPLES The following code will first print out "outside" and then "inside" twice, illustrating the fact that variable "s1" is defined only in the outer scope once. Variable "s2" exists only in inner scope: .RS 4 .EX begin-handler /scope public @<> set-string s1="outside" { set-string s2="inner variable" set-string s1="inside" @<> } @<> end-handler .EE .RE .SH SEE ALSO Program flow \fBbreak-loop\fP \fBcall-handler\fP \fBcode-blocks\fP \fBcontinue-loop\fP \fBdo-once\fP \fBexit-handler\fP \fBif-defined\fP \fBif-true\fP \fBquit-process\fP \fBreturn-handler\fP \fBstart-loop\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/purge-fifo.2gg0000664000175000017500000000122215021067665015043 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME purge-fifo \- (FIFO) .SH PURPOSE Delete FIFO list data. .SH SYNTAX .RS 4 .EX purge-fifo .EE .RE .SH DESCRIPTION purge-fifo will delete all elements from the FIFO , created by \fBnew-fifo\fP. The list is then empty and you can still put data into it, and get data from it afterwards, without having to call \fBnew-fifo\fP again. All keys or values stored in the list are also deleted. .SH EXAMPLES See \fBread-fifo\fP. .SH SEE ALSO FIFO \fBdelete-fifo\fP \fBnew-fifo\fP \fBpurge-fifo\fP \fBread-fifo\fP \fBrewind-fifo\fP \fBwrite-fifo\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/file-storage.2gg0000664000175000017500000000337615021067664015374 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME file-storage \- Golf documentation (files) .SH DESCRIPTION Golf provides a file directory that you can use for any general purpose, including for storing \fBtemporary-file\fPs. This directory is also used for automatic upload of files from clients. It provides a two-tier directory system, with sub-directories automatically created to spread the files for faster access. Files in Golf file directory are located in the sub-directories of: .RS 4 .EX /var/lib/gg//app/file .EE .RE If you wish to place this directory in another physical location, see \fBgg\fP. You can create files here by means of \fBuniq-file\fP, where a new unique file is created - with the file name made available to you. This directory is also used for uploading of files from clients (such as web browsers or mobile device cameras) - the uploading is handled automatically by Golf (see \fBget-param\fP). In general, a number of sub-directories is created within the file directory that contain files, which allows for billions of files to be kept. This scheme also allows for faster access to file nodes due to relatively low number of sub-directories and files randomly spread per each such sub-directory. The random spreading of files across subdirectories is done automatically. Do not rename file names or sub-directory names stored under file directory. .SH SEE ALSO Files \fBchange-mode\fP \fBclose-file\fP \fBcopy-file\fP \fBdelete-file\fP \fBfile-position\fP \fBfile-storage\fP \fBfile-uploading\fP \fBlock-file\fP \fBopen-file\fP \fBread-file\fP \fBread-line\fP \fBrename-file\fP \fBstat-file\fP \fBtemporary-file\fP \fBuniq-file\fP \fBunlock-file\fP \fBwrite-file\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/encrypt-data.2gg0000664000175000017500000002070515021067664015401 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME encrypt-data \- (encryption) .SH PURPOSE Encrypt data. .SH SYNTAX .RS 4 .EX encrypt-data to \\ [ input-length ] \\ [ binary [ ] ] \\ ( password \\ [ salt [ salt-length ] ] \\ [ iterations ] \\ [ cipher ] \\ [ digest ] [ cache ] [ clear-cache ) \\ [ init-vector ] .EE .RE .SH DESCRIPTION encrypt-data encrypts and stores the ciphertext to specified by "to" clause. .LP .B CIPHER AND DIGEST .LP By default, AES-256-CBC encryption and SHA256 hashing is used. You can however specify different cipher and digest algorithms with (in "cipher" clause) and (in "digest" clause) as long as \fBOpenSSL\fP supports them, or you have added them to OpenSSL. You can see the available ones by using: .RS 4 .EX \[char35]get list of cipher providers openssl list -cipher-algorithms \[char35]get list of digest providers openssl list -digest-algorithms .EE .RE Note that the default algorithms will typically suffice. If you use different algorithms, you should have a specific reason. If you use a specific cipher and digest for encoding, you must use the same for decoding. The key derivation method is PBKDF2. .LP .B DATA TO BE ENCRYPTED .LP If "input-length" clause is missing, then the number of bytes encrypted is the length of (see \fBstring-length\fP). If "input-length" clause is used, then bytes are encrypted. .LP .B PASSWORD .LP String (in "password" clause) is the password used to encrypt and it must be a null-terminated string. .LP .B SALT .LP String (in "salt" clause) is the salt used in Key Derivation Function (KDF) when an actual symmetric encryption key is created. If (in "salt-length" clause) is not specified, then the salt is null-terminated, otherwise it is a binary value of length . See \fBrandom-string\fP or \fBrandom-crypto\fP for generating a random salt. If you use the "salt" clause, then you must use the exact same when data is decrypted with \fBdecrypt-data\fP - typically salt values are stored or transmitted unencrypted. .LP .B ITERATIONS .LP The number of iterations used in producing a key is specified in in "iterations" clause. The default is 1000 per \fBRFC 8018\fP, though depending on your needs and the quality of password you may choose a different value. .LP .B INITIALIZATION VECTOR (IV) .LP Different encrypted messages should have a different IV value, which is specified with in the "init-vector" clause. See \fBrandom-string\fP or \fBrandom-crypto\fP for generating IV values. The decrypting side must use the same IV value to decrypt the message. Just like salt, IV is not a secret and is transmitted in plain text. Each cipher algorithm may require a certain number of bytes for IV. .LP .B ENCRYPTED DATA .LP The encrypted data is stored in (in "to" clause). The encrypted data can be a binary data (if "binary" clause is present without boolean variable , or if evaluates to true), which is binary-mode encryption; or if not, it will be a null-terminated string, which is character-mode encryption, consisting of hexadecimal characters (i.e. ranging from "0" to "9" and "a" to "f"). Character mode of encryption is convenient if the result of encryption should be a human readable string, or for the purposes of non-binary storage in the database. .LP .B CACHING KEY .LP A key used to actually encrypt/decrypt data is produced by using password, salt, cipher, digest and the number of iterations. Depending on these parameters (especially the number of iterations), computing the key can be a resource intensive and lengthy operation. You can cache the key value and compute it only once (or once in a while) by using "cache" clause. If you need to recompute the key once in a while, use "clear-cache" clause. is a "bool" variable; the key cache is cleared if it is true, and stays if it is false. For example with encrypt-data (the same applies to decrypt-data): .RS 4 .EX set-bool clear = true if-true q equal 0 encrypt-data dt init-vector non password pwd \\ salt rs salt-length 10 iterations iter to \\ dt_enc cache clear-cache clear .EE .RE In this case, when "q" is 0, cache will be cleared, with values of password, salt and iterations presumably changed, and the new key is computed and then cached. In all other cases, the last computed key stays the same. Normally, with IV usage (in "init-vector" clause), there is no need to change the key often, or at all. Note that while "cache" clause is in effect, the values for "password", "salt", "cipher", "digest" and "iterations" clauses can change without any effect. Only when "clear-cache" evaluates to "true" are those values taken into account. .LP .B SAFETY .LP Unless you are encrypting/decrypting a single message, you should always use IV in "init-vector" clause. Its purpose is to randomize the data encrypted, so that same messages do not produce the same ciphertext. If you use salt, a random IV is created with each different salt value. However, different salt values without "cache" clause will regenerate the key, which may be computationally intensive, so it may be better to use a different IV instead for each new encryption and keep the salt value the same with the high number of iterations. In practicality this means using "cache" so that key is computed once per process with the salt, and IV changes with each message. If you need to recompute the key occasionally, use "clear-cache". Each cipher/digest combination carries separate recommendations about the usage of salt, IV and the number of iterations. Please consult their documentation for more details. .SH EXAMPLES In the following example, the data is encrypted, and then decrypted, producing the very same data: .RS 4 .EX // Original string to encrypt set-string orig_data="something to encrypt!" // Encrypted data is in "res" variable encrypt-data orig_data password "mypass" to res // Decrypt what was just encrypted, decrypted data is in "dec_data" decrypt-data res password "mypass" to dec_data // Check that decrypted data matches the original if (!strcmp (orig_data, dec_data)) { @Success! } else { @Failure! } .EE .RE A more involved example below encrypts specific number of bytes (6 in this case). \fBrandom-string\fP is used to produce salt. The length of data to encrypt is given with "input-length" clause. The encrypted data is specified to be "binary" (meaning not as a human-readable string), so the "output-length" of such binary output is specified. The decryption thus uses "input-length" clause to specify the length of data to decrypt, and also "output-length" to get the length of decrypted data. Finally, the original data is compared with the decrypted data, and the length of such data must be the same as the original (meaning 6): .RS 4 .EX // Original data (only the first 6 bytes are encrypted) set-string orig_data="something to encrypt!" // Get 8 random binary bytes to be the salt random-string to newsalt length 8 binary // Encrypt data using salt and produce binary output (meaning it's not a null-terminated character string), with the // length of such output in "encrypted_len" variable. encrypt-data orig_data input-length 6 output-length encrypted_len password "mypass" salt newsalt to res binary // Decrypt the data encrypted above. The length of encrypted data is passed in "encrypted_len" variable, and then length of decrypted data // is obtained in "decrypted_len" variable. decrypt-data res output-length decrypted_len password "mypass" salt newsalt to dec_data input-length encrypted_len binary // Check if the 6 bytes of the original data matches decrypted data, and if exactly 6 bytes was decrypted if (!strncmp(orig_data,dec_data, 6) && decrypted_len == 6) { @Success! } else { @Failure! } .EE .RE An example of using different algorithms: .RS 4 .EX encrypt-data "some data!" password "mypwd" salt rs1 to encd1 cipher "camellia-256-cfb1" digest "sha3-256" decrypt-data encd1 password "mypwd" salt rs1 to decd1 cipher "camellia-256-cfb1" digest "sha3-256" .EE .RE .SH SEE ALSO Encryption \fBdecrypt-data\fP \fBderive-key\fP \fBencrypt-data\fP \fBhash-string\fP \fBhmac-string\fP \fBrandom-crypto\fP \fBrandom-string\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/syntax-highlighting.2gg0000664000175000017500000000170215021067665016774 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME syntax-highlighting \- Golf documentation (language) .SH DESCRIPTION For syntax highlighting of Golf programs in Vim, do this once: .RS 4 .EX gg -m .EE .RE The above will create a syntax file in your local Vim syntax directory: .RS 4 .EX $HOME/.vim/syntax/golf.vim .EE .RE and also update your local $HOME/.vimrc file to use this syntax for files with .golf extension. All files updated are local, i.e. they affect only the current user. Each user who wants this feature must issue the above command. You can then change the color scheme to anything you like by using ":colorscheme" directly in editor, or by specifying "colorscheme" in your ".vimrc" file for a persistent change. The Golf highlighting syntax is tested with Vim 8.1. .SH SEE ALSO Language \fBinline-code\fP \fBstatements\fP \fBsyntax-highlighting\fP \fBunused-var\fP \fBvariable-scope\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/hash-string.2gg0000664000175000017500000000336715021067664015242 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME hash-string \- (encryption) .SH PURPOSE Hash a string. .SH SYNTAX .RS 4 .EX hash-string to \\ [ binary [ ] \\ [ digest ] .EE .RE .SH DESCRIPTION hash-string produces by default a SHA256 hash of (if "digest" clause is not used), and stores the result into . You can use a different in "digest" clause (for example "SHA3-256"). To see a list of available digests: .RS 4 .EX \[char35]get digests openssl list -digest-algorithms .EE .RE If "binary" clause is used without boolean variable , or if evaluates to true, then the is a binary string that may contain null-characters. With the default SHA256, it is 32 bytes in length, while for instance with SHA3-384 it is 48 bytes in length, etc. Without "binary" clause, or if evaluates to false, each binary byte of hashed string is converted to two hexadecimal characters ("0"-"9" and "a"-"f"), hence is twice as long as with "binary" clause. .SH EXAMPLES String "result" will have a hashed value of the given string, an example of which might look like "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855": .RS 4 .EX hash-string "hello world" to hash .EE .RE Using a different digest: .RS 4 .EX hash-string "hello world" to hash digest "sha3-384" .EE .RE Producing a binary value instead of a null-terminated hexadecimal string: .RS 4 .EX hash-string "hello world" to hash digest "sha3-384" binary .EE .RE .SH SEE ALSO Encryption \fBdecrypt-data\fP \fBderive-key\fP \fBencrypt-data\fP \fBhash-string\fP \fBhmac-string\fP \fBrandom-crypto\fP \fBrandom-string\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/trim-string.2gg0000664000175000017500000000133715021067665015266 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME trim-string \- (strings) .SH PURPOSE Trim a string. .SH SYNTAX .RS 4 .EX trim-string .EE .RE .SH DESCRIPTION trim-string trims , both on left and right. .SH EXAMPLES The variable "str" will be "some string" after trim-string: .RS 4 .EX set-string str = " some string "; trim-string str .EE .RE .SH SEE ALSO Strings \fBconcatenate-strings\fP \fBcopy-string\fP \fBcount-substring\fP \fBdelete-string\fP \fBlower-string\fP \fBnew-string\fP \fBread-split\fP \fBreplace-string\fP \fBset-string\fP \fBsplit-string\fP \fBstring-length\fP \fBtrim-string\fP \fBupper-string\fP \fBwrite-string\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/unlock-file.2gg0000664000175000017500000000133415021067665015214 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME unlock-file \- (files) .SH PURPOSE Unlocks file. .SH SYNTAX .RS 4 .EX unlock-file id .EE .RE .SH DESCRIPTION unlock-file will unlock file that was locked with \fBlock-file\fP. is the value obtained in \fBlock-file\fP's "id" clause. .SH EXAMPLES See \fBlock-file\fP. .SH SEE ALSO Files \fBchange-mode\fP \fBclose-file\fP \fBcopy-file\fP \fBdelete-file\fP \fBfile-position\fP \fBfile-storage\fP \fBfile-uploading\fP \fBlock-file\fP \fBopen-file\fP \fBread-file\fP \fBread-line\fP \fBrename-file\fP \fBstat-file\fP \fBtemporary-file\fP \fBuniq-file\fP \fBunlock-file\fP \fBwrite-file\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/install-from-source-arch-manjaro.2gg0000664000175000017500000000251215021067664021247 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME install-from-source-arch-manjaro \- Golf documentation (install-golf) .SH DESCRIPTION .LP .B GET LATEST GOLF SOURCE CODE .LP You must have git installed. Get Golf source code for the latest version: .RS 4 .EX sudo pacman -Sy --noconfirm wget tar wget "https://github.com/golf-lang/golf/archive/refs/heads/main.tar.gz" -O main.tar.gz tar xvfz main.tar.gz cd golf-main .EE .RE .LP .B INSTALL DEPENDENCIES .LP .RS 4 .EX \[char46] ./PKGBUILD sudo pacman -Sy --noconfirm debugedit ${depends[@]} .EE .RE .LP .B BUILD GOLF .LP .RS 4 .EX make clean make sudo make install .EE .RE Here's how to \fBuninstall\fP. .SH SEE ALSO Install golf \fBinstall-arch-manjaro\fP \fBinstall-debian\fP \fBinstall-fedora-redhat-rocky-alma-centos-amazon-mageia\fP \fBinstall-from-source-arch-manjaro\fP \fBinstall-from-source-debian-ubuntu-raspbian\fP \fBinstall-from-source-fedora-redhat-rocky-alma-centos-amazon-mageia\fP \fBinstall-from-source-opensuse\fP \fBinstall-in-any-folder-arch-manjaro\fP \fBinstall-in-any-folder-debian-ubuntu-raspbian\fP \fBinstall-in-any-folder-fedora-redhat-rocky-alma-centos-amazon-mageia\fP \fBinstall-in-any-folder-opensuse\fP \fBinstall-opensuse\fP \fBinstall-raspbian\fP \fBinstall-ubuntu\fP \fBuninstall\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/utf-text.2gg0000664000175000017500000000441315021067665014565 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME utf-text \- (UTF) .SH PURPOSE Convert UTF (UTF8 or UTF16) string to text. .SH SYNTAX .RS 4 .EX utf-text \\ [ to ] \\ [ length ] \\ [ status ] \\ [ error-text ] .EE .RE .SH DESCRIPTION utf-text will convert text to (specified with "to" clause). If is omitted, then the result of conversion is output. is a string that may contain UTF characters (as 2, 3 or 4 bytes representing a unicode character). Encoding creates a string that can be used as a value where text representation of UTF is required. utf-text is performed according to \fBRFC7159\fP and \fBRFC3629\fP (UTF standard). Note that hexadecimal characters used for Unicode (such as \eu21d7) are always lowercase. Solidus character ("/") is not escaped, although \fBtext-utf\fP will correctly process it if the input has it escaped. The number of bytes in to be converted can be specified with in "length" clause. If is not specified, it is the length of string . Note that a single UTF character can be anywhere between 1 to 4 bytes. For example "љ" is 2 bytes in length. The status of encoding can be obtained in number . is the string length of the result in (or the number of bytes output if is omitted), or -1 if error occurred (meaning is an invalid UTF) in which case (if specified) is an empty string and the error text can be obtained in in "error-text" clause. .SH EXAMPLES Convert UTF string to text and verify the expected result: .RS 4 .EX // UTF string set-string utf_str = "\[char92]"Doc\[char92]"\en\et\eb\ef\er\et⇗⇘\et▷◮𝄞ᏫⲠш\en/\[char92]"()\et" // Convert UTF string to text utf-text utf_str status encstatus to text_text // This is the text expected (( expected_result @\[char92]"Doc\[char92]"\en\et\eb\ef\er\et\eu21d7\eu21d8\et\eu25b7\eu25ee\eud834\eudd1e\eu13eb\eu2ca0\eu0448\en/\[char92]"()\et )) // Make sure conversion was okay, decs is the length of the result (encj string) if-true text_text equal expected_result and encstatus not-equal -1 @decode-text worked okay end-if .EE .RE .SH SEE ALSO UTF \fBtext-utf\fP \fButf-text\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/copy-string.2gg0000664000175000017500000000342115021067664015260 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME copy-string \- (strings) .SH PURPOSE Copies string to another string. .SH SYNTAX .RS 4 .EX copy-string to \\ [ start-with ] \\ [ length ] .EE .RE .SH DESCRIPTION Use copy-string to copy to . number (in "start-with" clause) is the position in to start copying from, with 0 being the first byte. Without "length" clause, the whole of is copied. With "length" clause, exactly bytes are copied into . You can copy a string to itself. In this case, the original string remains and the new string references a copy: .RS 4 .EX set-string str = "original string" // string to change set-string orig = str // references original copy of the string to change copy-string str to str // make a copy of string to change and assign it to itself upper-string str // change the copy // Now "str" references "ORIGINAL STRING" // and "orig" references "original string" .EE .RE .SH EXAMPLES After copy-string below, "my_str" will be a copy of string "some value": .RS 4 .EX set-string other_string="some value" copy-string other_string to my_str .EE .RE Copy certain number of bytes, the result in "my_str" will be "ome": .RS 4 .EX set-string other_string="some value" copy-string other_string to my_str length 3 start-with 1 .EE .RE .SH SEE ALSO Strings \fBconcatenate-strings\fP \fBcopy-string\fP \fBcount-substring\fP \fBdelete-string\fP \fBlower-string\fP \fBnew-string\fP \fBread-split\fP \fBreplace-string\fP \fBset-string\fP \fBsplit-string\fP \fBstring-length\fP \fBtrim-string\fP \fBupper-string\fP \fBwrite-string\fP See all \fBdocumentation\fP golf-601.4.41-1/docs/get-time.2gg0000664000175000017500000001016015021067664014513 0ustar bearbear.TH GOLF 2gg $VERSION $DATE Development Tools .SH NAME get-time \- (time) .SH PURPOSE Get time. .SH SYNTAX .RS 4 .EX get-time to