1
0
Fork 0
Commit graph

46 commits

Author SHA1 Message Date
mfranz
7bbbfa6a8e use thisfunc() instead of caller(0)[1] 2008-07-22 23:26:46 +00:00
mfranz
54e6ec55b4 closure(): better error formatting 2008-07-22 22:50:42 +00:00
mfranz
e522611638 closure(): level is optional and defaults to 0 2008-07-22 22:38:34 +00:00
mfranz
1ad5b18ec8 closure(): must freeze io.open for the comparison 2008-07-22 22:26:09 +00:00
mfranz
dc4b8633a3 new io.open()'s closure musn't get manipulated either 2008-07-22 21:30:47 +00:00
mfranz
3cfc93927f make sure the closure of security code can't be manipulated by wrapping
closure()
2008-07-22 21:23:54 +00:00
mfranz
cb3150b915 (failing attempt to) lock down two functions 2008-07-22 16:46:18 +00:00
mfranz
32f1730c6e - load_nasal: better error message if compile() fails
- io.open handler: extract validation to separate function and
- add detached read/write validation listeners
2008-07-11 15:37:27 +00:00
mfranz
3be5c6956b io: use default attribs rather than a hard-coded number for globals identification
gui/tutorial/aircraft: use io.read_properties()/io.write_properties()
2008-07-11 09:37:33 +00:00
mfranz
9be716de1c typo 2008-07-10 16:55:45 +00:00
mfranz
8909695f36 add io.{read,write}_properties() convenience wrappers for
fgcommand("loadxml") and fgcommand("savexml")
2008-07-10 16:53:43 +00:00
mfranz
6e24e077ba - invert io.load_nasal() return value
- let load_rules() return nil or the path (rather than 0 or 1)
- better log output
- cosmetics
2008-07-03 16:23:13 +00:00
mfranz
6f9f70e84d - don't use undefined variable `curr'
- cosmetics
2008-06-22 18:00:02 +00:00
mfranz
caca942012 revert last change: don't append cwd to relative paths for now. There's
no way yet to safely detect absolute paths, so this would break on MS Windows.
This will only mean that relative paths will always fail, as they don't
match any pattern. These are all absolute.
2008-06-22 13:54:36 +00:00
mfranz
875b99c90e whoops, wrong quotes 2008-06-22 12:17:02 +00:00
mfranz
5240b57018 io.open(): turn relative paths into absolute ones before checking 2008-06-22 11:31:41 +00:00
mfranz
d86b1b9c74 string.nas: new functions string.join() and string.replace()
debug.nas: let benchmark() repeat tested function
io.nas: cosmetics
aircraft.nas: initialize time property only once
2008-06-21 07:10:32 +00:00
mfranz
ab08bfb8eb make sure that a die() (e.g. caused by an IOrules file being read protected)
doesn't disable the whole security mechanism
2008-06-16 11:19:29 +00:00
mfranz
94e010e4d1 whoops ... s/and/or/ 2008-06-16 11:00:05 +00:00
mfranz
bf9c2dc6a5 read rules for io.open() file access from $FG_ROOT/Nasal/IOrules or, if
available, from $FG_HOME/Nasal/IOrules. That's desirable because
ordinary users aren't allowed to edit files in $FG_ROOT.
2008-06-16 10:47:02 +00:00
mfranz
7cc783c2f5 this comes from not using tabs ... sigh 2008-06-16 07:16:10 +00:00
mfranz
b5cdfeb2b8 ... and allow reading only from ~/.fgfs/* and $FG_ROOT/* 2008-06-16 07:07:50 +00:00
mfranz
df018fff49 only allow writing to ~/.fgfs/Scenery/*.stg and ~/.fgfs/Export/* 2008-06-16 06:32:32 +00:00
mfranz
141f1c8da4 must not use setlistener in $FG_ROOT/Nasal/*.nas ... 2008-06-15 10:11:32 +00:00
mfranz
0fad328217 load_nasal: boolify result, as the number doesn't mean anything and might
be confusing
2008-06-14 22:39:28 +00:00
mfranz
62cc0f457c load_nasal: fix module and let it return whether there was an error 2008-06-14 14:25:34 +00:00
mfranz
a79c0e95c5 move load_nasal() here from the debug module 2008-06-14 14:22:34 +00:00
mfranz
c159ea1755 io.open(): drop die() color 2008-06-13 19:19:54 +00:00
mfranz
4a30ad6efe io.open(): remove debug messages (for easier code review) 2008-06-13 19:14:48 +00:00
mfranz
59e3d65545 and die() with red color for now 2008-06-13 13:18:16 +00:00
mfranz
0216b1a65c improve log messages 2008-06-13 13:08:56 +00:00
mfranz
4d17687f12 move fixpath back to string.nas. It *is* about strings, after all, and also
usable for property paths, so io.nas doesn't seem the right place.
2008-06-13 13:01:38 +00:00
mfranz
496a76b9fa and "br" as well :-) 2008-06-13 12:11:42 +00:00
mfranz
06aa2b772c open: allow "rb" everywhere like "r" 2008-06-13 12:09:45 +00:00
mfranz
2b3f574063 don't need /var/log/ 2008-06-13 11:57:20 +00:00
mfranz
7d9bd68742 - move fixpath() from "string" to "io" module
- first stab at Nasal security model: allow writing files only to authorized
  dirs. (Most of the debug messages will be removed later.)
2008-06-13 11:35:55 +00:00
mfranz
dfd21c722d - add more "var" keywords, fix indentation, drop some parentheses,
fix comments, consistency fixes, ...
- aircraft.nas: angular_lowpass -> minor speedup
2007-10-07 15:12:05 +00:00
mfranz
54c28ced16 what I do best: cosmetics 2007-07-01 18:54:32 +00:00
mfranz
faf9ea862d implement writexml() function for writing non-standard XML files
(that is: such that don't use PropertyList as root element and have
data hidden in attributes)
2007-07-01 15:05:16 +00:00
mfranz
122423aa2b - make io.readxml() a lot faster
- documentation update
2007-06-30 11:06:36 +00:00
mfranz
7b1ac37678 add readxml function that reads an XML file and returns it as property tree 2007-06-29 15:49:08 +00:00
mfranz
f827653668 - create new Nasal module string.nas with simple shell style pattern matching
algorithm (needed for the file selector and useful for other purposes, like
  assembling lists of livery or screenshot files etc.)
- io.nas: move fixpath to string.nas (it's not only useful for file paths
  but can also be used for property paths)
- screen.nas: move trim to string.nas (used by screen.nas and nasal-console.xml)
- gui.nas: add pattern matching to FileSelctor
- ufo.nas: use patterm matching (only *.ac and *.xml files shall be listed)
2007-06-22 14:13:30 +00:00
mfranz
183672f8a2 - don't prepend slash on relative paths or archaic paths with drive letters
- documentation updates
2007-06-14 11:26:16 +00:00
mfranz
0fed31d7b7 - fixpath: don't need to remove leading/trailing slashes "manually"; that's
a side effect of the stack loop already
- replace all backslashes by slashes, to avoid security problems on UNIX
  (if support for them is desirable on MS Windows, then we'd need an OS
  property)
2007-06-13 20:31:09 +00:00
mfranz
120d09b5e6 Andy ROSS: functions to check for stat()[2] flags, such as isdir()
mf: fixpath(): function to normalize file paths (doesn't handle escaped
    characters yet)
2007-06-13 16:46:41 +00:00
andy
3bcfb0624a Add soft-coded utilites to the "io" and "math" modules. The math
stuff is, for the most part, already available in the geo module; but
it's small and this naming matches the evolvoing "standard nasal
library".
2007-03-29 22:09:25 +00:00