Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef _TOONZ_H_
Toshihiro Shimizu 890ddd
#define _TOONZ_H_
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <sys types.h=""></sys>
Toshihiro Shimizu 890ddd
#include <sys stat.h=""></sys>
Toshihiro Shimizu 890ddd
#include "tmacro.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef TNZAPI
Toshihiro Shimizu 890ddd
#ifdef TNZ_IS_COMMONLIB
Toshihiro Shimizu 890ddd
#define TNZAPI TNZ_EXPORT_API
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define TNZAPI TNZ_IMPORT_API
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
   MEMORIA
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TNZAPI int meminfo_can_I_alloc(int size);
Toshihiro Shimizu 890ddd
TNZAPI int meminfo_get_lswap_free(void);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TNZAPI void drop_chunk(void *buffer);
Toshihiro Shimizu 890ddd
TNZAPI void release_memory_chunk(void *buffer);
Toshihiro Shimizu 890ddd
TNZAPI void *get_memory_chunk(int size);
Toshihiro Shimizu 890ddd
TNZAPI int not_enough_memory(void);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TNZAPI void init_check_memory(void);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef enum {
Shinya Kitaoka 120a6e
  TOONZ_ROOT,
Shinya Kitaoka 120a6e
  TOONZ_BIN,
Shinya Kitaoka 120a6e
  TOONZ_CONFIG,
Shinya Kitaoka 120a6e
  TOONZ_XRESOURCES,
Shinya Kitaoka 120a6e
  TOONZ_MISC,
Shinya Kitaoka 120a6e
  TOONZ_SCRIPTS,
Shinya Kitaoka 120a6e
  TOONZ_PIXMAP,
Shinya Kitaoka 120a6e
  TOONZ_SHELL_BUTTON,
Shinya Kitaoka 120a6e
  TOONZ_FLIP_BUTTON,
Shinya Kitaoka 120a6e
  TOONZ_WORK,
Shinya Kitaoka 120a6e
  TOONZ_ADM,
Shinya Kitaoka 120a6e
  TOONZ_TUTORIAL,
Shinya Kitaoka 120a6e
  TOONZ_SETUP_FILE,
Shinya Kitaoka 120a6e
  TOONZ_TMP,
Shinya Kitaoka 120a6e
  TOONZ_VARTMP,
Shinya Kitaoka 120a6e
  TOONZ_LINETEST_DATABASE,
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TOONZ_DIR_HOW_MANY
Toshihiro Shimizu 890ddd
} TOONZ_DIRECTORY;
Shinya Kitaoka 120a6e
/*
Shinya Kitaoka 120a6e
  NON FARE 'free' del puntatore ritornato
Toshihiro Shimizu 890ddd
  CONTROLLARE sempre la validita' del puntatore ritornato (!=NIL)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  TOONZ_TMP e TOONZ_VARTMP possono coincidere
Toshihiro Shimizu 890ddd
  tipicamente valgono c:\temp\tmp_toonz su NT
Toshihiro Shimizu 890ddd
  e rispettivamente /tmp/tmp_toonz e /var/tmp/tmp_toonz su Irix
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/* Introduciamo tnz_access per differenziarla sui vari systems
Toshihiro Shimizu 890ddd
   si puo' pensare di metterla altrove ( a vostra discrezione ) */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef WIN32
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <stdio.h></stdio.h>
Toshihiro Shimizu 890ddd
#include <direct.h></direct.h>
Toshihiro Shimizu 890ddd
/* Per access */
Toshihiro Shimizu 890ddd
#define TNZ_F_OK 0x00
Toshihiro Shimizu 890ddd
#define TNZ_R_OK 0x04
Toshihiro Shimizu 890ddd
#define TNZ_W_OK 0x02
Toshihiro Shimizu 890ddd
#define TNZ_X_OK 0x08
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/* Per chmod */
Toshihiro Shimizu 890ddd
#define TNZ_S_IRWXU _S_IWRITE | _S_IREAD /* read, write, execute: owner */
Shinya Kitaoka 120a6e
#define TNZ_S_IRUSR _S_IREAD             /* read permission: owner */
Shinya Kitaoka 120a6e
#define TNZ_S_IWUSR _S_IWRITE            /* write permission: owner */
Shinya Kitaoka 120a6e
#define TNZ_S_IXUSR 0                    /* execute permission: owner */
Shinya Kitaoka 120a6e
#define TNZ_S_IRWXG TNZ_S_IRWXU          /* read, write, execute: group */
Shinya Kitaoka 120a6e
#define TNZ_S_IRGRP TNZ_S_IRUSR          /* read permission: group */
Shinya Kitaoka 120a6e
#define TNZ_S_IWGRP TNZ_S_IWUSR          /* write permission: group */
Shinya Kitaoka 120a6e
#define TNZ_S_IXGRP TNZ_S_IXUSR          /* execute permission: group */
Shinya Kitaoka 120a6e
#define TNZ_S_IRWXO TNZ_S_IRWXU          /* read, write, execute: other */
Shinya Kitaoka 120a6e
#define TNZ_S_IROTH TNZ_S_IRUSR          /* read permission: other */
Shinya Kitaoka 120a6e
#define TNZ_S_IWOTH TNZ_S_IWUSR          /* write permission: other */
Shinya Kitaoka 120a6e
#define TNZ_S_IXOTH TNZ_S_IXUSR          /* execute permission: other */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <unistd.h></unistd.h>
Toshihiro Shimizu 890ddd
/* Per access */
Toshihiro Shimizu 890ddd
#define TNZ_F_OK F_OK
Toshihiro Shimizu 890ddd
#define TNZ_R_OK R_OK
Toshihiro Shimizu 890ddd
#define TNZ_W_OK W_OK
Toshihiro Shimizu 890ddd
#define TNZ_X_OK X_OK
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/* Per chmod */
Toshihiro Shimizu 890ddd
#define TNZ_S_IRWXU S_IRWXU /* read, write, execute: owner */
Toshihiro Shimizu 890ddd
#define TNZ_S_IRUSR S_IRUSR /* read permission: owner */
Toshihiro Shimizu 890ddd
#define TNZ_S_IWUSR S_IWUSR /* write permission: owner */
Toshihiro Shimizu 890ddd
#define TNZ_S_IXUSR S_IXUSR /* execute permission: owner */
Toshihiro Shimizu 890ddd
#define TNZ_S_IRWXG S_IRWXG /* read, write, execute: group */
Toshihiro Shimizu 890ddd
#define TNZ_S_IRGRP S_IRGRP /* read permission: group */
Toshihiro Shimizu 890ddd
#define TNZ_S_IWGRP S_IWGRP /* write permission: group */
Toshihiro Shimizu 890ddd
#define TNZ_S_IXGRP S_IXGRP /* execute permission: group */
Toshihiro Shimizu 890ddd
#define TNZ_S_IRWXO S_IRWXO /* read, write, execute: other */
Toshihiro Shimizu 890ddd
#define TNZ_S_IROTH S_IROTH /* read permission: other */
Toshihiro Shimizu 890ddd
#define TNZ_S_IWOTH S_IWOTH /* write permission: other */
Toshihiro Shimizu 890ddd
#define TNZ_S_IXOTH S_IXOTH /* execute permission: other */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
/* Prototipi delle funzioni contenute nella libreria common */
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
// TNZAPI char  *strsave (const char *str);
Toshihiro Shimizu 890ddd
TNZAPI char *strnsave(const char *str, int n);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TNZAPI int tnz_filestrcmp(const char *str1, const char *str2);
Toshihiro Shimizu 890ddd
TNZAPI int tnz_filestrncmp(const char *str1, const char *str2, int n);
Toshihiro Shimizu 890ddd
TNZAPI int tnz_strcasecmp(const char *str1, const char *str2);
Toshihiro Shimizu 890ddd
TNZAPI int tnz_strncasecmp(const char *str1, const char *str2, int n);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TNZAPI char *tnz_get_user_name(void);
Toshihiro Shimizu 890ddd
TNZAPI char *tnz_get_group_name(void);
Toshihiro Shimizu 890ddd
TNZAPI char *tnz_get_host_name(void);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TNZAPI char *tnzdir_get(TOONZ_DIRECTORY dir);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TNZAPI int tnz_access(char *filename, int mode);
Toshihiro Shimizu 890ddd
TNZAPI int tnz_stat(const char *name, struct stat *info);
Toshihiro Shimizu 890ddd
TNZAPI int tnz_mkdir(const char *path, int mode);
Toshihiro Shimizu 890ddd
TNZAPI int tnz_chdir(const char *path);
Toshihiro Shimizu 890ddd
TNZAPI int tnz_chmod(const char *path, int mode);
Toshihiro Shimizu 890ddd
TNZAPI int tnz_rename(const char *oldpath, const char *newpath);
Toshihiro Shimizu 890ddd
TNZAPI int tnz_remove(const char *path);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TNZAPI void tnz_sleep(const float seconds);
Toshihiro Shimizu 890ddd
TNZAPI int tnz_ms_time(void);
Toshihiro Shimizu 890ddd
TNZAPI double tnz_sec_time(void);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TNZAPI void tnz_random_seed(UINT seed);
Toshihiro Shimizu 890ddd
TNZAPI UCHAR tnz_random_byte(void);  /* in [0, 255] */
Shinya Kitaoka 120a6e
TNZAPI int tnz_random_int(void);     /* in [MININT, MAXINT] */
Toshihiro Shimizu 890ddd
TNZAPI UINT tnz_random_uint(void);   /* in [0, (UINT)MAXINT*2+1] */
Toshihiro Shimizu 890ddd
TNZAPI float tnz_random_float(void); /* in [0.0, 1.0) */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct trandom *TRANDOM;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TNZAPI TRANDOM trandom_create(void); /* seed: 0 */
Toshihiro Shimizu 890ddd
TNZAPI void trandom_destroy(TRANDOM trandom);
Toshihiro Shimizu 890ddd
TNZAPI void trandom_seed(TRANDOM trandom, UINT seed);
Toshihiro Shimizu 890ddd
TNZAPI UCHAR trandom_byte(TRANDOM trandom);  /* in [0, 255] */
Shinya Kitaoka 120a6e
TNZAPI int trandom_int(TRANDOM trandom);     /* in [MININT, MAXINT] */
Toshihiro Shimizu 890ddd
TNZAPI UINT trandom_uint(TRANDOM trandom);   /* in [0, (UINT)MAXINT*2+1] */
Toshihiro Shimizu 890ddd
TNZAPI float trandom_float(TRANDOM trandom); /* in [0.0, 1.0) */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TNZAPI short swap_short(short val);
Toshihiro Shimizu 890ddd
TNZAPI long swap_long(long val);
Toshihiro Shimizu 890ddd
TNZAPI USHORT swap_ushort(USHORT val);
Toshihiro Shimizu 890ddd
TNZAPI ULONG swap_ulong(ULONG val);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef WIN32
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TNZAPI TBOOL IsWin2000(void);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*temporaneo*/
Toshihiro Shimizu 890ddd
TNZAPI char *tnzdir_get_toonz_linetest_database(void);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
/* Prototipi delle funzioni contenute nella libreria security.a */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
int GetLibProtection(void);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif